packages feed

applicative-fail 1.0.0 → 1.1.0

raw patch · 3 files changed

+22/−2 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Control.Monad.Fail: mapFailTBase :: (forall x. m x -> n x) -> FailT e m a -> FailT e n a
+ Control.Monad.Fail: mapFailTFail :: Functor m => (e -> e') -> FailT e m a -> FailT e' m a

Files

CHANGELOG.md view
@@ -1,5 +1,12 @@ # CHANGELOG +## 1.1.0++### Added++* `mapFailTBase` - map inner monad (e.g. lift)+* `mapFailTFail` - map error type+ ## 1.0.0  ### Added
applicative-fail.cabal view
@@ -1,9 +1,9 @@ name:                applicative-fail-version:             1.0.0+version:             1.1.0 synopsis:            Applicative functor and monad which collects all your fails  description: Applicative functor to perform parse-like actions and-             collect wanrings/failures.+             collect warnings/failures.  license:             BSD3 license-file:        LICENSE@@ -38,6 +38,7 @@                      , GeneralizedNewtypeDeriving                      , LambdaCase                      , MultiParamTypeClasses+                     , RankNTypes                      , ScopedTypeVariables                      , StandaloneDeriving                      , TupleSections
src/Control/Monad/Fail.hs view
@@ -6,6 +6,8 @@          FailT(..)        , runFailC        , runFailI+       , mapFailTBase+       , mapFailTFail         -- * Helper functions        , mfail        , mwarn@@ -18,6 +20,7 @@ import Control.Monad.Reader import Control.Monad.State import Control.Monad.Writer+import Data.Bifunctor import Data.Foldable import Data.Functor.Compose import Data.Functor.Identity@@ -132,6 +135,15 @@ runFailI :: FailT e Identity a -> Fail e a runFailI = runIdentity . runFailT {-# INLINEABLE runFailI #-}++mapFailTBase :: (forall x. m x -> n x) -> FailT e m a -> FailT e n a+mapFailTBase f (FailT ma) = FailT $ f ma+{-# INLINEABLE mapFailTBase #-}++-- | Like 'first' from 'Bifunctor' maps error type+mapFailTFail :: (Functor m) => (e -> e') -> FailT e m a -> FailT e' m a+mapFailTFail f (FailT ma) = FailT $ fmap (first f) ma+{-# INLINEABLE mapFailTFail #-}  deriving instance Eq (m (Fail e a)) => Eq (FailT e m a) deriving instance Ord (m (Fail e a)) => Ord (FailT e m a)