[Haskell-cafe] forall and a parse error
rturk at science.uva.nl
Wed Nov 15 17:59:20 EST 2006
Probably unrelated, but this thread is what triggered it for me.
There is a minor bug in showing impredicative types without
-fglasgow-exts: *hope I got that right*
Prelude> let x =  :: [forall a. a]
Warning: Accepting non-standard infix type constructor `.'
Use -fglasgow-exts to avoid this warning
Prelude> :t x
x :: [. (forall a) a]
When -fglasgow-exts is set it shows what it should:
Prelude> :t x
x :: [forall a. a]
On Tue, Jul 04, 2006 at 04:55:49PM +0100, Simon Peyton-Jones wrote:
> 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
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe