G'day all.

Quoting Henning Thielemann <[EMAIL PROTECTED]>:

> Why replacing the almost-function 'if' by a special syntactic construct?

In a sense, this is entirely stylistic.  One works just as well as
the other.

But I think it's superior in this case (obviously not all cases) because
this is at the top-level (i.e. on the RHS of a top-level function
definition), and one "arm" of the if-then-else is a call to "error", that
is, a precondition/domain/sanity check.

These pre-checks are almost always different from the "real" business
that the function performs.  Using guards makes the separation that much
more obvious.

Cheers,
Andrew Bromage
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to