From e1c79038c3d0bc4cfca4413601217f365b60910d Mon Sep 17 00:00:00 2001 From: Leonid Vasilev Date: Wed, 27 Apr 2022 14:51:05 +0300 Subject: [PATCH] [#208] `redundant constraint` test 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. --- test/Test/Universum/Issue208.hs | 23 +++++++++++++++++++++++ universum.cabal | 4 +++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 test/Test/Universum/Issue208.hs diff --git a/test/Test/Universum/Issue208.hs b/test/Test/Universum/Issue208.hs new file mode 100644 index 00000000..f5181183 --- /dev/null +++ b/test/Test/Universum/Issue208.hs @@ -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 diff --git a/universum.cabal b/universum.cabal index 81857333..1f04237b 100644 --- a/universum.cabal +++ b/universum.cabal @@ -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