
Hi all, I have base==3.* code that uses errorCalls and ioErrors to intercept either ErrorCall or IOError that may arise in deeper code. I'd like to convert this code to base==4.* new exceptions. -- | Evaluate the argument and catch error call exceptions errorToErr :: Monad m => a -> Err m a errorToErr x = let e = unsafePerformIO (tryJust errorCalls (evaluate x)) in ErrorT (return e) -- | Catch IO errors in the error monad. ioErrorToErr :: IO a -> Err IO a ioErrorToErr = ErrorT . liftM (either (Left . show) Right) . tryJust ioErrors Look here for more context: http://hackage.haskell.org/packages/archive/haxr/3000.5/doc/html/Network-Xml... I know that just importing OldException will do the trick for now. But I'd like to know how to do such a trick in extensible exceptions way. Also that unsafePerformIO looks a bit scary. Isn't there a better way to achieve purpose? -- Gracjan