[Haskell-cafe] Syntax for lambda case proposal could be "\of"
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:
>> which doesn't suffer this problem since the keyword "of" can never
>> follow a '\' in the existing grammar.
> Or how about:
> \case of
> which seems clearer to me.
> Similarly, the keyword "case" can never follow a '\' in the existing
> Mind you, this doesn't seem to save much over
> \x -> case x of
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
Allowing multiple arguments - is syntactically difficult to reconcile
with 'case' because it restricts what single-argument forms can be used?
> case foo of Just n -> n
is allowed but
> f Just n = n
More information about the Haskell-Cafe