The All About Monads page on the Haskell Wiki gives this definition for the error monad:
class Error a where
noMsg :: a
strMsg :: String -> a
class (Monad m) => MonadError e m | m -> e where
throwError :: e -> m a
catchError :: m a -> (e -> m a) -> m a
instance MonadError (Either e) where
throwError = Err
(Err e) `catchError` handler = handler e
a `catchError` _ = a
I do not understand this fully, especially the line
class (Monad m) => MonadError e m | m -> e where
What does this mean?