Embrace -XTypeInType, add -XStarIsType
[ghc.git] / testsuite / tests / polykinds / T7594.hs
1 {-# LANGUAGE FlexibleInstances #-}
2 {-# LANGUAGE UndecidableInstances #-}
3 {-# LANGUAGE MultiParamTypeClasses #-}
4 {-# LANGUAGE UndecidableSuperClasses #-}
5 {-# LANGUAGE KindSignatures #-}
6 {-# LANGUAGE TypeOperators #-}
7 {-# LANGUAGE ConstraintKinds #-}
8 {-# LANGUAGE GADTs #-}
9 {-# LANGUAGE Rank2Types #-}
10
11 module T7594 where
12
13 import Data.Kind (Constraint, Type)
14
15 class (c1 t, c2 t) => (:&:) (c1 :: Type -> Constraint)
16 (c2 :: Type -> Constraint)
17 (t :: Type)
18 instance (c1 t, c2 t) => (:&:) c1 c2 t
19
20 data ColD c where
21 ColD :: (c a) => a -> ColD c
22
23 app :: (forall a. (c a) => a -> b) -> ColD c -> b
24 app f (ColD x) = f x
25
26 q :: ColD (Show :&: Real)
27 q = ColD (1.2 :: Double)
28
29 bar = app print q
30 -- This one works, as a result of fixing Trac #8644,
31 -- because the given constraint is
32 -- (Show :&: Real) a, which has no equality superclasses
33
34 q2 :: ColD (c :&: Real)
35 q2 = error "urk"
36
37 bar2 = app print q2
38 -- This one fail, because the given constraint is
39 -- (c :&: Real) a, which might have equality superclasses