
22 Aug
2012
22 Aug
'12
3:02 p.m.
Quoting "Matthew Steele"
{-# LANGUAGE Rank2Types #-}
class FooClass a where ...
foo :: (forall a. (FooClass a) => a -> Int) -> Bool foo fn = ...
newtype IntFn a = IntFn (a -> Int)
bar :: (forall a. (FooClass a) => IntFn a) -> Bool bar (IntFn fn) = foo fn
In case you hadn't yet discovered it, the solution here is to unpack the IntFn a bit later in a context where the required type argument is known: bar ifn = foo (case ifn of IntFn fn -> fn) Hope this helps. Lauri