Brian Hulley wrote:
I'm puzzled why GHC chooses to create illegal types instead  of
finding the innermost quantification point ie I would think that

        (Ord a=> a->a) -> Int

should then "obviously" be shorthand for

         (forall a. Ord a=> a->a) -> Int

and surely this could easily be implemented by just prepending "forall a b c" onto any context restricting a b c... (?)

I agree that it's strange to add an implicit quantifier and then complain that it's in the wrong place. I suspect Simon would change this behavior if you complained about it. My preferred behavior, though, would be to reject any type that has a forall-less type class constraint anywhere but at the very beginning. I don't think it's a good idea to expand implicit quantification. Also, the rule would not be quite as simple as you make it out to be, since

    forall a. (forall b. Foo a b => a -> b) -> Int

is a legal type, for example.

-- Ben

_______________________________________________
Glasgow-haskell-users mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to