Exception Handling

Smelly Pooh plop@redbrick.dcu.ie
Tue, 28 Nov 2000 11:15:14 +0000


I'm writing an application at the moment (in Haskell duh) and the issue of
exception handling has come up.  I don't want to use Maybe (because that would
destructure the code somewhat) or any kind of Monad and I've settled on the
idea of SPJs Exception extension.  The idea is to create a data type with a
different constructor per exception as in

data MyException  =  Ex1 | Ex2 | Ex3

then use throwDyn/catchDyn to throw and catch it.  Unfortunately this requires
MyException to be an instance of class Typeable, and the documentation on that
is quite sparse.  Any advice or pointers would be greatly appreciated