Quelklef

milk consumer

girly but not a girl

name-color: #C09

You must log in to comment.

in reply to @Quelklef's post:

actually, wouldn't having the MonadError instance be inherited from Either mean that you cannot throw or catch exceptions in m?

i feel like i'd be down to work in ExceptT e m a directly, though, that sounds fun

hmm so by "exceptions in m", do you mean imprecise exceptions (as in error) or IO exceptions? imprecise exceptions should pretty much "just work", but if you need IO exceptions, you can always manually lift the functions out of your newtype (as in throwProgrammerError = MkYourMonad . throw).
but I guess recovering from programmer errors doesn't make much sense from inside the monad anyway.

what I like about the newtype approach is that you're in control about how much of the underlying error handling mechanisms you expose. if you decide you want to allow catching exceptions, you can just expose that but if you don't, you don't have to.