[Haskell-cafe] Why does Haskell have the if-then-else syntax?
sylvan at student.chalmers.se
Wed Jul 26 21:44:54 EDT 2006
On 7/27/06, mvanier <mvanier at cs.caltech.edu> wrote:
> As opposed to what?
For example case-of, guards (in combination with let or where), or
just a function:
if :: Bool -> a -> a -> a
if True t _ = t
if False _ e = e
-- example usage
myAbs x = if (x < 0) (negate x) x
More information about the Haskell-Cafe