diff options
Diffstat (limited to 'testsuite/tests/deriving/should_compile/drv-foldable-traversable1.hs')
-rw-r--r-- | testsuite/tests/deriving/should_compile/drv-foldable-traversable1.hs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/testsuite/tests/deriving/should_compile/drv-foldable-traversable1.hs b/testsuite/tests/deriving/should_compile/drv-foldable-traversable1.hs new file mode 100644 index 0000000000..712f14a3b5 --- /dev/null +++ b/testsuite/tests/deriving/should_compile/drv-foldable-traversable1.hs @@ -0,0 +1,33 @@ +{-# LANGUAGE DeriveFunctor, DeriveFoldable, DeriveTraversable #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE FlexibleContexts, DatatypeContexts #-} + +module ShouldCompile where + +import Data.Foldable +import Data.Traversable + +data Trivial a = Trivial + deriving (Functor,Foldable,Traversable) + +-- lots of different things +data Strange a b c + = T1 a b c + | T2 c c c + | T3 [a] [b] [c] -- lists + | T4 [[a]] [[b]] [[c]] -- nested lists + | T5 (c,(b,b),(c,c)) -- tuples + | T6 ([c],Strange a b c) -- tycons + deriving (Functor,Foldable,Traversable) + +data NotPrimitivelyRecursive a + = S1 (NotPrimitivelyRecursive (a,a)) + | S2 a + deriving (Functor,Foldable,Traversable) + +data Eq a => StupidConstraint a b = Stupid a b + deriving (Functor,Foldable,Traversable) + +-- requires Foldable/Traversable constraint on f and g +data Compose f g a = Compose (f (g a)) + deriving (Functor,Foldable,Traversable) |