Embrace -XTypeInType, add -XStarIsType
[ghc.git] / testsuite / tests / typecheck / should_compile / tc191.hs
1 {-# LANGUAGE RankNTypes #-}
2
3 -- This only typechecks if forall-hoisting works ok when
4 -- importing from an interface file. The type of Twins.gzipWithQ
5 -- is this:
6 -- type GenericQ r = forall a. Data a => a -> r
7 -- gzipWithQ :: GenericQ (GenericQ r) -> GenericQ (GenericQ [r])
8 -- It's kept this way in the interface file for brevity and documentation,
9 -- but when the type synonym is expanded, the foralls need expanding
10
11 module Foo where
12
13 import Data.Generics.Basics
14 import Data.Generics.Aliases
15 import Data.Generics.Twins(gzipWithQ)
16
17 -- | Generic equality: an alternative to \deriving Eq\
18 geq :: Data a => a -> a -> Bool
19 geq x y = geq' x y
20 where
21 -- This type signature no longer works, because it is
22 -- insufficiently polymorphic.
23 -- geq' :: forall a b. (Data a, Data b) => a -> b -> Bool
24 geq' :: GenericQ (GenericQ Bool)
25 geq' x y = (toConstr x == toConstr y)
26 && and (gzipWithQ geq' x y)
27
28
29