packages feed

either 4.1 → 4.1.1

raw patch · 3 files changed

+16/−16 lines, 3 files

Files

either.cabal view
@@ -1,6 +1,6 @@ name:          either category:      Control, Monads-version:       4.1+version:       4.1.1 license:       BSD3 cabal-version: >= 1.6 license-file:  LICENSE
src/Control/Monad/Trans/Either.hs view
@@ -62,7 +62,7 @@ -- apomorphism is the generalized anamorphism for this Monad, but it cannot be -- written with 'ErrorT'. ----- In addition to the combinators here, the @errors@ package provides a large +-- In addition to the combinators here, the @errors@ package provides a large -- number of combinators for working with this type. newtype EitherT e m a = EitherT { runEitherT :: m (Either e a) } @@ -269,18 +269,18 @@     EitherT <$> traverse (either (pure . Left) (fmap Right . f)) a   {-# INLINE traverse #-} -instance (Error e, MonadBase b m) => MonadBase b (EitherT e m) where+instance MonadBase b m => MonadBase b (EitherT e m) where   liftBase = liftBaseDefault   {-# INLINE liftBase #-} -instance Error e => MonadTransControl (EitherT e) where+instance MonadTransControl (EitherT e) where   newtype StT (EitherT e) a = StEitherT {unStEitherT :: Either e a}   liftWith f = EitherT $ liftM return $ f $ liftM StEitherT . runEitherT   {-# INLINE liftWith #-}   restoreT = EitherT . liftM unStEitherT   {-# INLINE restoreT #-} -instance (Error e, MonadBaseControl b m) => MonadBaseControl b (EitherT e m) where+instance MonadBaseControl b m => MonadBaseControl b (EitherT e m) where   newtype StM (EitherT e m) a = StMEitherT { unStMEitherT :: StM m (StT (EitherT e) a) }   liftBaseWith = defaultLiftBaseWith StMEitherT   {-# INLINE liftBaseWith #-}
src/Data/Either/Combinators.hs view
@@ -39,7 +39,7 @@ -- --------------------------------------------------------------------------- -- Functions over Either --- |The 'isLeft' function returns 'True' iff its argument is of the form @Left _@.+-- |The 'isLeft' function returns 'True' iff its argument is of the form @'Left' _@. -- -- Using @Control.Lens@: --@@ -56,7 +56,7 @@ isLeft (Left _) = True isLeft _        = False --- |The 'isRight' function returns 'True' iff its argument is of the form @Right _@.+-- |The 'isRight' function returns 'True' iff its argument is of the form @'Right' _@. -- -- Using @Control.Lens@: --@@ -89,7 +89,7 @@ fromLeft' (Left x)  = x  -- | Extracts the element out of a 'Right' and--- throws an error if its argument take the form  @'Left' _@.+-- throws an error if its argument take the form @'Left' _@. -- -- Using @Control.Lens@: --@@ -128,7 +128,7 @@ mapBoth _ f (Right x) = Right (f x)  -- | The 'mapLeft' function takes a function and applies it to an Either value--- iff the value takes the form 'Left _'.+-- iff the value takes the form @'Left' _@. -- -- Using @Data.Bifunctor@: --@@ -156,13 +156,13 @@ mapLeft :: (a -> c) -> Either a b -> Either c b mapLeft f = mapBoth f id --- | The 'mapLeft' function takes a function and applies it to an Either value--- iff the value takes the form 'Left _'.+-- | The 'mapRight' function takes a function and applies it to an Either value+-- iff the value takes the form @'Right' _@. -- -- Using @Data.Bifunctor@: -- -- @--- 'mapRight' = first+-- 'mapRight' = second -- @ -- -- Using @Control.Arrow@:@@ -174,7 +174,7 @@ -- Using @Control.Lens@: -- -- @--- 'mapRight' = 'over' '_Right'+-- 'mapRight' = over _Right -- @ -- -- >>> mapRight (*2) (Left "hello")@@ -186,7 +186,7 @@ mapRight = mapBoth id  -- | The 'whenLeft' function takes an 'Either' value and a function which returns a monad.--- The monad is only executed when the given argument takes the form @Left _@, otherwise+-- The monad is only executed when the given argument takes the form @'Left' _@, otherwise -- it does nothing. -- -- Using @Control.Lens@:@@ -201,8 +201,8 @@ whenLeft (Left x) f = f x whenLeft _        _ = pure () --- | The 'whenLeft' function takes an 'Either' value and a function which returns a monad.--- The monad is only executed when the given argument takes the form @Right _@, otherwise+-- | The 'whenRight' function takes an 'Either' value and a function which returns a monad.+-- The monad is only executed when the given argument takes the form @'Right' _@, otherwise -- it does nothing. -- -- Using @Data.Foldable@: