[Haskell-cafe] forall and a parse error

Neil Mitchell ndmitchell at gmail.com
Mon Jul 3 14:44:30 EDT 2006


I was experimenting with forall and higher rank types briefly, in particular:

x :: [forall a . a]

This is illegal because of:

Which is fine, however its surprising to compare the error messages:

[forall a . a]
parse error on input `forall'

[(forall a . a)]
    Illegal polymorphic or qualified type: forall a. a
    In the type signature: lst :: [(forall a. a)]

In normal Haskell, I tend to view [x] as equivalent to [(x)] (provided
that x is not a tuple) but in this case it has a different meaning -
albeit both are erronous meanings.

When running the example with Hugs, they both come out as syntax
errors - the first on the forall, the second on the closing square



More information about the Haskell-Cafe mailing list