Thanks for the ~ syntax, but my question is really
why you need it?  What benefit do you get from
"refutable patterns"?

Alternatively, would anything break if a future
Haskell just treated all patterns as irrefutable?

-Alex-

_________________________________________________________________
S. Alexander Jacobson                  mailto:[EMAIL PROTECTED]
tel:917-770-6565                       http://alexjacobson.com


On Tue, 30 Mar 2004, Martin [ISO-8859-1] Sj�gren wrote:

> tis 2004-03-30 klockan 17.30 skrev S. Alexander Jacobson:
> > I would assume that this function:
> >
> >   foo list@(h:t) = list
> >
> > is equivalent to
> >
> >   foo list = list
> >      where (h:t)=list
> >
> > But passing [] to the first generates an error
> > even though h and t are never used!  Passing [] to
> > the second works just fine.
>
> You can write this as
>
> > foo' list@(~(h:t)) = list
>
> foo' [] will evaluate to []. The H98 report calls it an "irrefutable
> pattern", IIRC.
>
>
> Regards,
> Martin
>

_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to