[Haskell-cafe] Re: Exception handling in numeric computations

Gregory Petrosyan gregory.petrosyan+haskell at gmail.com
Sat Mar 28 05:52:27 EDT 2009

On Sat, Mar 28, 2009 at 10:53 AM, Ketil Malde <ketil at malde.org> wrote:
> So the difference between an exception or an error type is mainly what
> you intend to do about it.  There's no point in wrapping divisions in
> Maybe unless you actually are able to do something useful to recover
> from a zero denominator.

That is exactly the point I was trying to make.

When I write a code, I can't say in advance, in what way it will be used.
So, for dealing with errors, I have to choose one way or another, mostly
without that knowledge. When I'm using e.g. C++, it's easy:
something like mantra "when in doubt, throw an exception" :-)
combined with RAII, works good (but not ideal, of course).

So, I'll ask again: when I program in Haskell, what mechanism should I use?


More information about the Haskell-Cafe mailing list