Skip to content

Commit

Permalink
[serokell#208] redundant constraint test
Browse files Browse the repository at this point in the history
Problem: in `ghc-8.6.3` your code can produce `redundant constraint` warning
if you derive `Container` for newtype, but in `ghc-9.0.2` and newer
no warnings would be produced.

Solution: added test, that should be compiled with `ghc-9.0.2` and newer
without warnings.
  • Loading branch information
DK318 committed Apr 28, 2022
1 parent 4396fa9 commit e1c7903
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
23 changes: 23 additions & 0 deletions test/Test/Universum/Issue208.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{-# LANGUAGE
GeneralizedNewtypeDeriving
, UndecidableInstances
, FlexibleContexts
, GADTs
, DerivingStrategies
, CPP
#-}
module Test.Universum.Issue208
() where

#if __GLASGOW_HASKELL__ >= 900

import Universum (Container)

-- In ghc-8.6.3 this code will produce a @redundant constraint@ warning.
-- In ghc-9.0.2 and newer no warnings would be produced.
-- Issue #208: https://github.com/serokell/universum/issues/208

newtype Test = Test [Int]
deriving newtype (Container)

#endif
4 changes: 3 additions & 1 deletion universum.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ test-suite universum-test
hs-source-dirs: test
main-is: Spec.hs

other-modules: Test.Universum.Property
other-modules:
Test.Universum.Issue208
Test.Universum.Property

build-depends: universum
, bytestring
Expand Down

0 comments on commit e1c7903

Please sign in to comment.