[Haskell-cafe] forall and a parse error

Simon Peyton-Jones simonpj at microsoft.com
Tue Jul 4 11:55:49 EDT 2006

It's a parsing infelicity.  (Inside square brackets the parser knows not
to expect a forall, whereas inside round parens it might.)  Perhaps it
should be more accepting in square brackets, and reject later.

Which the current HEAD does -- actually [forall a. a->a] is ok in the
HEAD, see our ICFP06 paper.


| -----Original Message-----
| From: haskell-cafe-bounces at haskell.org
[mailto:haskell-cafe-bounces at haskell.org] On Behalf Of Neil
| Mitchell
| Sent: 03 July 2006 19:44
| To: Haskell Cafe
| Subject: [Haskell-cafe] forall and a parse error
| Hi,
| I was experimenting with forall and higher rank types briefly, in
| 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
| bracket.
| Thanks
| Neil
| _______________________________________________
| Haskell-Cafe mailing list
| Haskell-Cafe at haskell.org
| http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list