blob: efab2df2240fcc3a9ba655ceed1970b7de277942 (
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
|
{-# LANGUAGE KindSignatures, ConstraintKinds, MultiParamTypeClasses, FlexibleInstances, UndecidableInstances #-}
module Ctx where
import GHC.Prim( Constraint )
data Proxy (ctxt :: * -> Constraint) = Proxy
-- At one time, this one worked:
nonmeth :: ctxt Int => Proxy ctxt -> a
nonmeth prox = nonmeth prox
class Foo (ctxt :: * -> Constraint) a where
meth :: ctxt a => Proxy ctxt -> a
instance ctxt Int => Foo ctxt Int where
-- But this one didn't:
meth prox = meth prox
-- The error was:
-- Could not deduce (ctxt Int) arising from a use of `meth'
-- from the context (ctxt Int)
-- The problem was that irreducible evidence did not interact with
-- evidence of equal type.
|