[Haskell-cafe] Haskell and the Software design process

Ketil Malde ketil at malde.org
Mon May 3 16:55:50 EDT 2010


Gregory Collins <greg at gregorycollins.net> writes:

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

>>>> http://www.haskell.org/ghc/docs/6.12.2/html/libraries/base-4.2.0.1/Control-Exception.html#v%3Athrow

>>> I see. This should be forbidden, at all! :-)

>> Why is this worse than or different from 'error'?  To me it looks like
>> 'error', only with a non-string parameter.

> Calling 'error' is just as bad IMO!

Which is the same as 'as good'?

I think error is legitimate in many cases. For instance:

* when you know a branch will never be taken, you can add an 'error
  "this will never happen"' which both informs other readers of the
  code of the intended usage, and provides a greppable message if you
  were wrong.

* for stub functions during development ('undefined' doesn't tell you
  which undefined value you tried to evaluate)

* Functions like division, which is still useful, even if it is
  partial. 

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants


More information about the Haskell-Cafe mailing list