[Haskell] Syntax Q: How do you share RHS's in case expressions!?

Ryan Newton newton at ai.mit.edu
Fri Oct 22 12:02:15 EDT 2004


I'm baffled that I can't find anywhere in the documentation how to 
associate two or more patterns with the same right-hand-side...

For example, in OCaml:

     match 3 with 3 -> 99 | 4 -> 99

Can be abbreviated

     match 3 with 3 | 4 -> 99

But I have had no luck figuring out how to do the same thing with:

     case 3 of 3 -> 99; 4 -> 99

My apologies if the answer to this question is blindingly obvious!

--Ryan



More information about the Haskell mailing list