packages feed

errors 1.4.2 → 1.4.3

raw patch · 2 files changed

+31/−2 lines, 2 filesdep ~either

Dependency ranges changed: either

Files

Control/Error/Util.hs view
@@ -20,6 +20,8 @@     isLeft,     isRight,     fmapR,+    AllE(..),+    AnyE(..),      -- * EitherT     fmapRT,@@ -40,6 +42,7 @@ import Control.Monad.Trans.Either (EitherT(EitherT, runEitherT)) import Control.Monad.Trans.Maybe (MaybeT(MaybeT, runMaybeT)) import Data.Dynamic (Dynamic)+import Data.Monoid (Monoid(mempty, mappend)) import System.Exit (ExitCode) import System.IO (hPutStr, hPutStrLn, stderr) @@ -107,6 +110,32 @@ -- | 'fmap' specialized to 'Either', given a name symmetric to 'fmapL' fmapR :: (a -> b) -> Either l a -> Either l b fmapR = fmap++{-| Run multiple 'Either' computations and succeed if all of them succeed++    'mappend's all successes or failures+-}+newtype AllE e r = AllE { runAllE :: Either e r }++instance (Monoid e, Monoid r) => Monoid (AllE e r) where+    mempty = AllE (Right mempty)+    mappend (AllE (Right x)) (AllE (Right y)) = AllE (Right (mappend x y))+    mappend (AllE (Right _)) (AllE (Left  y)) = AllE (Left y)+    mappend (AllE (Left  x)) (AllE (Right _)) = AllE (Left x)+    mappend (AllE (Left  x)) (AllE (Left  y)) = AllE (Left  (mappend x y))++{-| Run multiple 'Either' computations and succeed if any of them succeed++    'mappend's all successes or failures+-}+newtype AnyE e r = AnyE { runAnyE :: Either e r }++instance (Monoid e, Monoid r) => Monoid (AnyE e r) where+    mempty = AnyE (Right mempty)+    mappend (AnyE (Right x)) (AnyE (Right y)) = AnyE (Right (mappend x y))+    mappend (AnyE (Right x)) (AnyE (Left  _)) = AnyE (Right x)+    mappend (AnyE (Left  _)) (AnyE (Right y)) = AnyE (Right y)+    mappend (AnyE (Left  x)) (AnyE (Left  y)) = AnyE (Left  (mappend x y))  -- | 'fmap' specialized to 'EitherT', given a name symmetric to 'fmapLT' fmapRT :: (Monad m) => (a -> b) -> EitherT l m a -> EitherT l m b
errors.cabal view
@@ -1,5 +1,5 @@ Name: errors-Version: 1.4.2+Version: 1.4.3 Cabal-Version: >=1.8.0.2 Build-Type: Simple License: BSD3@@ -23,7 +23,7 @@ Library     Build-Depends:         base         >= 4     && < 5  ,-        either       >= 3.1   && < 3.5,+        either       >= 3.1   && < 4.1,         safe         >= 0.3.3 && < 0.4,         transformers >= 0.2   && < 0.4     Exposed-Modules: