Adds absorber for MonadCatch (as well as MonadThrow, but that is a superclass of MonadCatch so I just use the MonadCatch absorber for both).
Added a custom run-function, runErrorForMonadCatch, as well, because people will usually want to map the SomeException type to something less opaque so there will almost always be a runError . mapError f sort of thing and I just made it explicit. But maybe that's bad form since it's trivial? The oddness of SomeException tripped me up a bit in testing so I thought I would add the run function to help others with the same issue.
Added some tests, throwing exceptions and handling some.
Added the exceptions package to package.yaml
Bumped the polysemy-zoo version to 0.7.0.0 in package.yaml as well.
Note: I didn't attempt to add an absorber for MonadMask because that gets into asynchronous exceptions, etc. and I don't know much about all that. But that seems like a useful thing to add in the future if anyone is interested.
Here's the PR to resolve https://github.com/polysemy-research/polysemy-zoo/issues/40.
MonadCatch
(as well asMonadThrow
, but that is a superclass ofMonadCatch
so I just use theMonadCatch
absorber for both).runErrorForMonadCatch
, as well, because people will usually want to map theSomeException
type to something less opaque so there will almost always be arunError . mapError f
sort of thing and I just made it explicit. But maybe that's bad form since it's trivial? The oddness ofSomeException
tripped me up a bit in testing so I thought I would add the run function to help others with the same issue.Note: I didn't attempt to add an absorber for
MonadMask
because that gets into asynchronous exceptions, etc. and I don't know much about all that. But that seems like a useful thing to add in the future if anyone is interested.