
Both the transformers[1] and mtl[2] define a class named 'Error', for use with MonadError and ErrorT. This class is required for the instance of Monad (and therefore MonadTrans, MonadIO, etc). However, I can't figure out why this class exists. Its presence means that instead of something like: ------------------------------------- data NameError = ErrorFoo | ErrorBar validateName :: Monad m => Text -> m (Either Error Text) validateName x = runErrorT $ do when (some condition) $ throwError ErrorFoo when (other condition) $ throwError ErrorBar return x ------------------------------------- I have to define this, which is more verbose, no more useful, and adds a "fake" class to the Haddock docs (with a warning not to use it): ------------------------------------- data Error = ErrorFoo | ErrorBar instance Error NameError where strMsg = error -- validateName ... ------------------------------------- Is there any good reason why the 'Error' class can't just be removed? [1] http://hackage.haskell.org/packages/archive/transformers/0.2.0.0/doc/html/Co... [2] http://hackage.haskell.org/packages/archive/mtl/1.1.0.2/doc/html/Control-Mon...