[Haskell-cafe] Syntax for lambda case proposal could be "\of"

Stefan O'Rear stefanor at cox.net
Wed Aug 15 14:06:36 EDT 2007


On Wed, Aug 15, 2007 at 06:58:40PM +0100, Duncan Coutts wrote:
> On Wed, 2007-08-15 at 10:50 -0700, Stefan O'Rear wrote:
> 
> > OTOH, your proposal provides (IMO) much more natural syntax for
> > multi-pattern anonymous functions, especially if we stipulate that
> > unlike a case (but like a lambda) you can have multiple arguments; then
> > you could write stuff like:
> > 
> > sumTo0 = foldr (\of 0 k -> 0
> >                     n k -> n + k) 0
> > 
> > Anyone else like this?
> 
> Why not just:
> 
> sumTo0 = foldr (\0 k -> 0
>                  n k -> n + k) 0

Because it would break a very large amount of old code, and I think H'
was supposed to be upward compatible:

foo = getSomethingCPS $ \ arg ->
      moreStuff

is now a syntax error (\ { varid -> } matches no productions).

Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20070815/3280322a/attachment.bin


More information about the Haskell-Cafe mailing list