Permalink
Browse files

Delegated failure.

  • Loading branch information...
1 parent 6081217 commit d08b575d678417fd2c3be404c409073d99a26e02 @ekmett committed Feb 2, 2013
Showing with 8 additions and 1 deletion.
  1. +4 −0 CHANGELOG.markdown
  2. +1 −1 either.cabal
  3. +3 −0 src/Control/Monad/Trans/Either.hs
View
4 CHANGELOG.markdown
@@ -1,3 +1,7 @@
+3.4
+---
+* Delegate `fail` to the underlying `Monad`, rather than `error`.
+
3.3
---
* Inverted roles between `Semigroup` and `Alt`. This let us write `Alternative` and `MonadPlus` instances that are compatible.
View
2 either.cabal
@@ -1,6 +1,6 @@
name: either
category: Control, Monads
-version: 3.3
+version: 3.4
license: BSD3
cabal-version: >= 1.6
license-file: LICENSE
View
3 src/Control/Monad/Trans/Either.hs
@@ -184,6 +184,9 @@ instance Monad m => Monad (EitherT e m) where
Left l -> return (Left l)
Right r -> runEitherT (k r)
{-# INLINE (>>=) #-}
+ fail = EitherT . fail
+ {-# INLINE fail #-}
+
instance Monad m => MonadError e (EitherT e m) where
throwError = EitherT . return . Left

0 comments on commit d08b575

Please sign in to comment.