UNPOPULAR OPINION: HASKELL EDITION
Hit me!
Conversation
LambdaCase though
1
7
LambdaCase has such an ugly and unintuitive syntax that it should die. It’s useful, but it should have different syntax.
3
12
I don't like \ for lambdas in general. I get what it was going for, but it just doesn't look good.
1
1
1
What would you have chosen instead?
1
How about picking the same syntax as for sections? I.e., leave out the expression, eg (case of True -> t; False -> f)
2
6
That's close to what I'm planning for Global Script: analyze —. case true. x, case false. y,
Global Script uses Unicode for functions: λ 'x. e
(Global Script is also in love with ., as you can tell, in the name of syntactic uniformity. That's the key difference from Haskell.)
1
I'm trying this currently:
both-zero : U32 -> U32 -> String;
both-zero n = case n {
0 0 => "yup";
0 _ => "almost";
_ 0 => "possibly";
_ _ => "nope";
};
ie. case expressions can have multiple patterns, but there needs to be the same number for each branch.
1
1
If there are more patterns in the branch then those become 'parameters' to the case expression.
So you can have:
both-zero : U32 -> U32 -> String;
both-zero = case {
0 0 => "yup";
0 _ => "almost";
_ 0 => "possibly";
_ _ => "nope";
};
1






