[Haskell-cafe] Errors in non-monadic code
Jerzy Karczmarczuk
jerzy.karczmarczuk at unicaen.fr
Mon Aug 19 23:49:04 CEST 2013
jabolopes at google.com :
> I would like to see more code move away from exceptions and into
> types like "Maybe" or "Either" or other types defined for the
> particular situation (as some people were suggesting in the beginning
> of the thread). And the reason for this it is because when you program
> against types you have to make a decision whether to handle the error
> or let it bleed through: you can't ignore the choice because you can't
> ignore the type. On the other hand, with exceptions, you can easily
> forget to handle the exception if you're not looking at the
> documentation at the time when you write the code.
Tom Ellis:
> This is/exactly/ the reason to avoid exceptions where possible.
I disagree.
Types which neutralize some particular conditions (whether you call them
exceptional or not is conventional) and propagate "Nothing" etc. is not
a panacea.
Some exceptions, e.g. in the traversal of deep structures may be and ARE
used as escaping continuations. Calling all that "not the right thing to
do", or issuing other normative statements is, how would I express it...
, is not the right thing to do. Now you can add here some dozen smileys...
More seriously, some people like exquisite continuations and will use
them. Instead of fighting against exceptions it might be more fruitful
to make them more robust, powerful, parametrable and sexy.
Jerzy Karczmarczuk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130819/462f40be/attachment.htm>
More information about the Haskell-Cafe
mailing list