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

Isaac Dupree isaacdupree at charter.net
Wed Aug 15 17:02:47 EDT 2007


Duncan Coutts wrote:
> On Wed, 2007-08-15 at 18:23 +0100, Brian Hulley wrote:
> 
>> Therefore I propose:
>>
>>     \of
>>         alts
>>
>> which doesn't suffer this problem since the keyword "of" can never 
>> follow a '\' in the existing grammar.
> 
> Or how about:
> 
> \case of
>     alts
> 
> which seems clearer to me.
> 
> Similarly, the keyword "case" can never follow a '\' in the existing
> grammar.
> 
> Mind you, this doesn't seem to save much over
> 
> \x -> case x of
>     alts

It saves the writer using an explicit name which must be unique and the 
reader determining that the name is not used deeper in the expressions. 
(and a "->").  I tend to find myself wanting this after already having 
written a 'case' and decided I don't need/want a name for the thing 
being 'cased'.  I wouldn't mind "case of", "\of" or "\case of", for 
using it.

Allowing multiple arguments - is syntactically difficult to reconcile 
with 'case' because it restricts what single-argument forms can be used? 
Such as:
 >   case foo of Just n -> n
is allowed but
 > f Just n = n
isn't.


Isaac


More information about the Haskell-Cafe mailing list