On 25-Aug-1999, Keith Wansbrough <[EMAIL PROTECTED]> wrote:
> According to the Haskell 98 report, patterns have the following grammar:
> 
> apat ::= var [ @ apat ]
>       |  ~ apat
>       | ...etc...
> 
> Thus the following program should be legal (IMHO):
> 
> main = let foo@~(x,y) = (1,2)
>        in  print foo
> 
> Instead, both Hugs and GHC report
> 
>   ERROR "TestAsPat.hs" (line 1): Undefined variable "foo"
> 
> What have I missed?

What's the lexical syntax?  Is `@~' one token, or two?

I haven't checked the Haskell report, but I suspect that the
problem with your example is that `@~' is being parsed as a single
token, so the grammar rules containing `@' and `~' don't apply since
there is no `@' or `~' token in your example, only a `@~' token.
Try replacing `@~' with `@ ~' and see if that helps.

-- 
Fergus Henderson <[EMAIL PROTECTED]>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger [EMAIL PROTECTED]        |     -- the last words of T. S. Garp.


Reply via email to