[Haskell-cafe] Bloom Filter

ajb at spamcop.net ajb at spamcop.net
Wed May 2 23:21:35 EDT 2007


G'day all.

Quoting Henning Thielemann <lemming at henning-thielemann.de>:

> 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


More information about the Haskell-Cafe mailing list