haskell-issues icon indicating copy to clipboard operation
haskell-issues copied to clipboard

Language extension: caseMay

Open Gurkenglas opened this issue 8 years ago • 3 comments

caseMay x of
  A -> a
  B -> b

would be desugared to

case x of
  A -> Just a
  B -> Just b
  _ -> Nothing

. Then there would be the corresponding LambdaCase equivalent and perhaps this would all be generalized to any Alternative. Compare fail's use in do notation.

Gurkenglas avatar Apr 02 '16 08:04 Gurkenglas