| So I would claim that these two types are the same:
| 
|   forall x. Class x => (forall y. Class y => y -> y) -> x -> x
|   (forall y. Class y => y -> y) -> (forall x. Class x => x -> x)
| 
| ...so you should be able to do this:
| 
|   combinator :: (forall y. Class y => y -> y) -> (forall x. 
| Class x => x  -> x)
|   combinator f x = combinator' f x
| 
| but for some reason GHC 5.02.2 complains. I think this is a bug. 

Indeed the two types are the same.  In fact GHC does "forall-lifting"
on type signatures to bring the foralls to the front.  But there's a bug
in 5.02's forall-lifting... it doesn't bring the constraints to the
front too.

I fixed this in 5.03 a while ago, but didn't back-propagate the fix to 
5.02.  And indeed, 5.03 is happy with the pure rank-2 program.

class Class x where
 combinator' :: (forall y. Class y => y -> y) -> x -> x

combinator :: (forall y. Class y => y -> y)
           -> (forall x. Class x => x -> x)
combinator f = combinator' f


It's quite a bit of extra work propagating fixes into the 5.02 branch,
so I probably won't do so for this one, since only a small minority
of people will trip over it.   Perhaps you can try the 5.03 snapshot
release?

Simon

_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to