[Haskell-cafe] Syntax for lambda case proposal could be "\of"
Stefan O'Rear
stefanor at cox.net
Wed Aug 15 13:50:36 EDT 2007
On Wed, Aug 15, 2007 at 06:23:24PM +0100, Brian Hulley wrote:
> Hi,
> On http://hackage.haskell.org/trac/haskell-prime/wiki/LambdaCase the
> proposed syntax for lambda case is:
>
> case of
> alts
>
> but this has a really bad downside for interactive editors: it doesn't
> allow one to distinguish between an incomplete construct and a completed
> construct thus removing one opportunity for an editor to alert the user (eg
> by highlighting) that there is something missing in the program text.
It's not like the current language has that property; consider (map
myFunction) - is that an error or a partial application?
I don't hold out much hope for context-free smart editors. You'll need
a typechecker to do much of use, and that can easily distinguish lambda
cases from regular cases...
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?
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/70e2e05b/attachment.bin
More information about the Haskell-Cafe
mailing list