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