Add kind equalities to GHC.
[ghc.git] / testsuite / tests / typecheck / should_compile / tc257.hs
1 {-# LANGUAGE KindSignatures, ConstraintKinds, MultiParamTypeClasses, FlexibleInstances, UndecidableInstances #-}
2 module Ctx where
3
4 import Data.Kind ( Constraint )
5
6 data Proxy (ctxt :: * -> Constraint) = Proxy
7
8 -- At one time, this one worked:
9 nonmeth :: ctxt Int => Proxy ctxt -> a
10 nonmeth prox = nonmeth prox
11
12
13 class Foo (ctxt :: * -> Constraint) a where
14 meth :: ctxt a => Proxy ctxt -> a
15
16 instance ctxt Int => Foo ctxt Int where
17 -- But this one didn't:
18 meth prox = meth prox
19
20 -- The error was:
21 -- Could not deduce (ctxt Int) arising from a use of `meth'
22 -- from the context (ctxt Int)
23
24 -- The problem was that irreducible evidence did not interact with
25 -- evidence of equal type.