Common syntax for casing/matching (Re[2]: Call to arms: lambda-case is stuck and needs your help)

Bulat Ziganshin bulat.ziganshin at
Thu Jul 12 23:48:34 CEST 2012

Hello wagnerdm,

Thursday, July 5, 2012, 7:22:38 PM, you wrote:

>> After 21 months of occasional arguing the lambda-case proposal(s) is

this reminded me old joke about PL/I: camel is the horse created by committee

i propose to return back and summarize all the requirements we have in
this area. and then try to develop global solution matching them all.
my summary of requirements follows:

> Now we have 3 ways to performing casing/matching:

> function definition:  f (Just x) (Just y) | x>0 = ...  multi-line, multi-parameter
> case statement: case ... of Just x | x>0 -> ... multi-line, single-parameter, different syntax
> lambda: \(Just x) (Just y) -> ...  single-line, multi-parameter, case-like syntax

> What we probably need is to have common syntax for all 3 cases.

another interesting feature may be ruby-style matching defined by
execution of special function `match` instead of pattern matching:

switch var of
  1+1     -> print "var==2"
  [5..10] -> print "var in [5..10]"
  (>20)   -> print "var>20"

where (var `match` (1+1)), (var `match` [5..10]), (var `match` (>20)) is tested

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at

More information about the Glasgow-haskell-users mailing list