failable 1.2.2.0 → 1.2.3.0
raw patch · 3 files changed
+14/−5 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Control.Monad.Failable: autohoist :: (e ~ SomeException, Hoistable m t e) => t a -> m a
+ Control.Monad.Failable: class (MonadTrans t, Monad m) => RunnableStateT t s m
+ Control.Monad.Failable: runS :: RunnableStateT t s m => t m a -> s -> m (a, s)
Files
- failable.cabal +3/−3
- package.yaml +1/−1
- src/Control/Monad/Failable.hs +10/−1
failable.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.31.1.+-- This file has been generated from package.yaml by hpack version 0.31.2. -- -- see: https://github.com/sol/hpack ----- hash: 8cc31ec3ac9375294a36a9da93d185c21007f0c218f60c268b752c2d859ae579+-- hash: 93b641ce8250cf5be47f3dd076ef5b7275d1730554ece2b325f4e75617100984 name: failable-version: 1.2.2.0+version: 1.2.3.0 synopsis: A 'Failable' error monad class to unify failure across monads that can fail description: This library contains a 'Failable' error monad class to unify failure across monads and transformers most commonly used to implement pipelines that can fail and does so in a simple nonsense way by providing the means of signaling a computation "failure" while striving to keep the failure behaviour consistent with the actual definition of the monad/transformer. Please refer to the README file for a more elaborate description and some examples. category: control, exceptions, monad
package.yaml view
@@ -1,5 +1,5 @@ name: failable-version: 1.2.2.0+version: 1.2.3.0 license: BSD3 author: "Erick Gonzalez" maintainer: "erick@codemonkeylabs.de"
src/Control/Monad/Failable.hs view
@@ -67,7 +67,12 @@ -- >>> runMaybeT $ foo 2 :: IO (Maybe Int) -- >>> Nothing --- Failable(..), Hoistable(..), failableIO) where+ Failable(..),+ Hoistable(..),+ RunnableStateT(..),+-- * Utility functions+ autohoist,+ failableIO) where import Data.Bifunctor (second) import Control.Exception (Exception(..), SomeException(..), throw, catch)@@ -115,6 +120,10 @@ -- hoist :: (Exception e) => (e' -> e) -> t a -> m a +-- | Utility function to capture the idiom `hoist id` .. which is used to promote a type+-- to a failable without requiring any error transformation+autohoist :: (e ~ SomeException, Hoistable m t e) => t a -> m a+autohoist = hoist id instance Failable IO where failure = throw