Quoting "Matthew Steele" <mdste...@alum.mit.edu>:

    {-# 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



_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to