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