<div dir="ltr">I ran into a scenario where the use of MonadError would only be valid if <div>  catchError (pure a) h = pure a<br></div><div>was a law, so I looked up the laws in <a href="https://hackage.haskell.org/package/mtl-2.3/docs/Control-Monad-Error-Class.html#t:MonadError">https://hackage.haskell.org/package/mtl-2.3/docs/Control-Monad-Error-Class.html#t:MonadError</a> but surprisingly found none.</div><div><br></div><div>One would expect to see</div><div>  1. catchError (pure a) h = pure a<br>  2. catchError (throwError e) h = h e<br></div><div>  3. throwError e >>= f = throwError e</div><div><br></div><div>which would rule out silly instances like</div><div>  instance MonadError () Maybe where<br>    throwError ()        = Nothing<br>    catchError _ f = f ()<br></div><div><br></div><div>Searching for "monad error laws" gives me no haskell results, only <a href="https://typelevel.org/blog/2018/04/13/rethinking-monaderror.html">https://typelevel.org/blog/2018/04/13/rethinking-monaderror.html</a> which suggests the same laws.</div><div><br></div><div>I propose adding these 3 laws to MonadError haddocks.</div><div>AFAICT the IO/Maybe/Either/ExceptT instances in <a href="https://hackage.haskell.org/package/mtl-2.3/docs/src/Control.Monad.Error.Class.html%20">https://hackage.haskell.org/package/mtl-2.3/docs/src/Control.Monad.Error.Class.html%20</a> all obey the laws.</div></div>