
Here's a crazy question: would a version of MonadError without the
fundep do the trick?
class Monad m => MonadFail e m where
fail :: e -> m a
instance MonadFail a [] where
fail = const []
instance (a ~ e) => MonadFail e (Either a) where
fail = Left
instance MonadFail SomeException IO where
fail = throwIO
instance MonadFail IOException IO where
fail = throwIO
...
instance MonadFail String IO where
fail = throwIO . userError
On Wed, Jun 10, 2015 at 8:32 AM, Mario Blažević
+1 from me.
A minor nitpick: the proposal should clarify which of the existing instances of Monad from base get a MonadFail instance. My understanding is that none of them would define fail = error, but that has not been made explicit.
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries