In response to my recent message (below), Ross asks:

"Are you rejecting the fix I suggested:

        Add a side condition to the grammar in 3.13: the guard must not
        end with a type signature (because the following -> looks like
        part of the type)."

Indeed, this would be possible.  It would reject programs like
        f x = case x of { (a,b) | b :: Bool -> a }
which are in principle reasonable, but are really hard to parse.
Indeed, GHC, Hugs, and nhc all reject it.

I suppose that the term "ends with" is a bit imprecise, too.  Presumably
this would be OK
        f x = case x of { (a,b) | (b :: Bool) -> a }

Still, Ross's suggestion is pragmatic: if all the impls find this corner
of the language too hard to parse, then some guidance about what 
not to write would be a good plan.

As usual, this is not a big deal: it's a dark corner that few will trip
over.  But it is my joyful task (aided by many others) to try to 
illuminate the darkness, so I invite your opinions about which
fix (the one below, or Ross's) is better.

Simon

-----Original Message-----
From: Ross Paterson [mailto:[EMAIL PROTECTED]] 
Sent: 11 March 2002 17:59
To: Simon Peyton-Jones
Subject: Re: H98 Report: expression syntax glitch


Simon,

> Ross points out that this is really hard to parse:
> 
> |     case x of y | ($ True) $ \ z -> z :: Bool -> Bool -> y
> 
> because the parser doesn't know when to stop eating the type and treat

> the arrow as the case-alternative arrow.

> But in neither case can I see a cure that is better than the
> disease.  Remember, large-scale fixes are out of court.

An easier case than Carl's, I think.
_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to