
Brian Hulley wrote:
Stefan O'Rear wrote:
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
sumTo0 = foldr (\0 k -> 0 n k -> n + k) 0
foo = getSomethingCPS $ \ arg -> moreStuff
is now a syntax error (\ { varid -> } matches no productions).
A multi-way lambda could be introduced using \\ thus:
sumTo0 = foldr (\\ 0 k -> 0; n k -> n + k) 0
I like the idea, but unfortunately '\\' is currently a regular operator symbol. In fact it is used as (set or map) 'difference' operator (according to http://www.haskell.org/ghc/docs/latest/html/libraries/doc-index-92.html): \\ 1 (Function) Data.IntMap 2 (Function) Data.IntSet 3 (Function) Data.List 4 (Function) Data.Map 5 (Function) Data.Set Cheers Ben