Ideally, you'd be able to
import Control.Exception.Safe
and be on your way; "drop-in replacement" or whatever. To that end, safe-exceptions re-exports MonadThrow, which is nice. It does not, however, export the throwM method of MonadThrow, instead having its own throwM function (which is just a convenience alias for throw).
The catch is that if you need to implement your own instance of MonadThrow,
instance MonadThrow Program where
throwM = liftIO . throwM
you end up with
src/Program.hs:108:5-10: error:
‘throwM’ is not a (visible) method of class ‘MonadThrow’
|
108 | throwM = liftIO . throwM
| ^^^^^^
which is a tad inconvenient. I was about to send you a pull request changing the export to MonadThrow(throwM) when I realized that there is already a throwM and its not the class method. So I'm not sure what to do here. Having to do
import Control.Exception.Safe hiding (throwM)
import Control.Monad.Catch (MonadThrow(throwM))
seems likely to not be what you had in mind. How can I help put this right?
AfC
Ideally, you'd be able to
and be on your way; "drop-in replacement" or whatever. To that end, safe-exceptions re-exports MonadThrow, which is nice. It does not, however, export the
throwMmethod of MonadThrow, instead having its ownthrowMfunction (which is just a convenience alias forthrow).The catch is that if you need to implement your own instance of MonadThrow,
you end up with
which is a tad inconvenient. I was about to send you a pull request changing the export to
MonadThrow(throwM)when I realized that there is already athrowMand its not the class method. So I'm not sure what to do here. Having to doseems likely to not be what you had in mind. How can I help put this right?
AfC