News for hackers. Stuff that matters.
Re:“Mostly functional” programming does not work (2014) by michaelochurch on Monday June 22, 2015 @11:08AM (#9758828)
You can blow up the runtime with integer division by zero, however.

    λ 1 `quot` 0
    *** Exception: divide by zero
With `1/0`, it uses `Double` because `(/)` requires a Fractional type.

Also, partial functions like `head` or `fromJust` can burn you:

    λ head []
    *** Exception: Prelude.head: empty list
The latter is a legacy behavior that is generally considered undesirable. The former is more debatable; some would say that you should avoid integer division by an unknown value as much as possible.

In Haskell, exceptions in non-IO code (other than deliberate hard crashes) are generally considered a wart to be avoided and mitigated as much as possible (because they interfere with functional programming).

There are no comments on this comment yet.