[Haskell-beginners] What is the Haskell idiom for "if then else if then"

Peter Hickman peterhi at ntlworld.com
Mon Mar 30 11:33:02 EDT 2009


I've just written this piece of code

     if r < 0
     then LEFT
     else
         if r > 0
         then RIGHT
         else STRAIGHT

which works just fine but it does look rather clunky (as it would in  
any language I suppose). Is there a Haskell idiom for this type of code?



More information about the Beginners mailing list