[Haskell-beginners] Case statements shorter

Angel Alonso alderzdev at gmail.com
Mon Nov 1 11:59:33 EDT 2010


Hi,

I have the following piece of code:

n = 3
case n of
    3 -> "Something"
    4 -> "Something"
   _ -> "Other"

Is it possible to shorten the case statement into something like this?:

n = 3
case n of
    3 or 4 -> "Something"
    _ -> "Other"

Thanks.

-- Angel Alonso


More information about the Beginners mailing list