packages feed

hoist-error 0.1.0.1 → 0.1.0.2

raw patch · 2 files changed

+9/−1 lines, 2 filesdep +eitherdep ~basedep ~mtlPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

Dependencies added: either

Dependency ranges changed: base, mtl

API changes (from Hackage documentation)

+ Control.Monad.Error.Hoist: instance (m ~ n, MonadError e' m) => HoistError m (EitherT e n) e e'

Files

hoist-error.cabal view
@@ -1,5 +1,5 @@ name:                hoist-error-version:             0.1.0.1+version:             0.1.0.2 synopsis:            Some convenience facilities for hoisting errors into a monad license:             MIT license-file:        LICENSE@@ -18,6 +18,7 @@   exposed-modules:     Control.Monad.Error.Hoist   build-depends:       base >=4.7 && <4.8                      , mtl >=2.2.1+                     , either   hs-source-dirs:      src   default-language:    Haskell2010 
src/Control/Monad/Error/Hoist.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FunctionalDependencies #-}+{-# LANGUAGE GADTs #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE UnicodeSyntax #-} @@ -12,7 +13,10 @@ ) where  import Control.Monad.Error.Class+import Control.Monad.Trans.Either +import Control.Monad.Trans+ -- | A tricky class for easily hoisting errors out of partiality types (e.g. -- 'Maybe', @'Either' e@) into a monad. The parameter @e@ represents the error -- information carried by the partiality type @t@, and @e'@ represents the type@@ -33,6 +37,9 @@  instance MonadError e' m ⇒ HoistError m (Either e) e e' where   hoistError f = either (throwError . f) return++instance (m ~ n, MonadError e' m) ⇒ HoistError m (EitherT e n) e e' where+  hoistError f = eitherT (throwError . f) return  -- | A flipped synonym for 'hoistError'. (<%?>)