[Haskell-cafe] Inverting a Monad

Bas van Dijk v.dijk.bas at gmail.com
Wed Feb 6 09:21:26 EST 2008

On Feb 6, 2008 12:51 PM, Bas van Dijk <v.dijk.bas at gmail.com> wrote:
> I will try out requiring 'm' to have a 'MonadError' constraint and see how far I come
> with that.

I'm now trying to define 'inv' using 'catchError` but I can't get it to work.

The following obviously doesn't work:

import Control.Monad.Error

inv :: MonadError e m => m a -> m ()
inv m = (m >> fail "") `catchError` \_ -> (return ())


More information about the Haskell-Cafe mailing list