packages feed

either 3.1 → 3.2

raw patch · 3 files changed

+12/−4 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Control.Monad.Trans.Either: instance Monad m => Semigroup (EitherT e m a)
+ Control.Monad.Trans.Either: instance (Monad m, Semigroup e) => Semigroup (EitherT e m a)

Files

CHANGELOG.markdown view
@@ -1,3 +1,7 @@+3.2+---+* Changed the `Semigroup` to use a `Semigroup` to combine `Left` branches. Left `Alt` untouched, so you can mix and match.+ 3.1 --- * Added instances for `mtl` classes and `MonadRandom`.
either.cabal view
@@ -1,6 +1,6 @@ name:          either category:      Control, Monads-version:       3.1+version:       3.2 license:       BSD3 cabal-version: >= 1.6 license-file:  LICENSE
src/Control/Monad/Trans/Either.hs view
@@ -139,14 +139,18 @@       Right x -> return (Right (k x))   {-# INLINE (<*>) #-} -instance Monad m => Semigroup (EitherT e m a) where+instance (Monad m, Semigroup e) => Semigroup (EitherT e m a) where   EitherT m <> EitherT n = EitherT $ m >>= \a -> case a of-    Left _ -> n+    Left l -> liftM (\b -> case b of+      Left l' -> Left (l <> l')+      Right r -> Right r) n     Right r -> return (Right r)   {-# INLINE (<>) #-}  instance (Functor m, Monad m) => Alt (EitherT e m) where-  (<!>) = (<>)+  EitherT m <!> EitherT n = EitherT $ m >>= \a -> case a of+    Left _  -> n+    Right r -> return (Right r)   {-# INLINE (<!>) #-}  instance (Functor m, Monad m) => Bind (EitherT e m) where