failable 1.2.0.1 → 1.2.1.0
raw patch · 3 files changed
+11/−8 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- failable.cabal +3/−2
- package.yaml +4/−1
- src/Control/Monad/Failable.hs +4/−5
failable.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 1e63a61c70483d7525dbe87ed02e180668b9ff7107e8fd8c94524e24a739df96+-- hash: a12b7ae7ae934beec28ed91e40ed4a43c1eceb1d8828a108bab9bdb63c453133 name: failable-version: 1.2.0.1+version: 1.2.1.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@@ -34,6 +34,7 @@ Paths_failable hs-source-dirs: src+ ghc-options: -Wall -fno-warn-orphans build-depends: base >=4.8 && <5 , mtl >=2.2 && <2.3
package.yaml view
@@ -1,5 +1,5 @@ name: failable-version: 1.2.0.1+version: 1.2.1.0 license: BSD3 author: "Erick Gonzalez" maintainer: "erick@codemonkeylabs.de"@@ -31,3 +31,6 @@ library: source-dirs: src+ ghc-options:+ - -Wall+ - -fno-warn-orphans
src/Control/Monad/Failable.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE GADTs #-}-{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE UndecidableInstances #-} @@ -72,7 +72,6 @@ import Data.Bifunctor (second) import Control.Exception (Exception(..), SomeException(..), throw, catch)-import Control.Monad (join) import Control.Monad.Except (ExceptT(..), runExceptT, throwError) import Control.Monad.IO.Class (MonadIO, liftIO) import Control.Monad.State.Class (MonadState, get, put)@@ -81,9 +80,7 @@ import Control.Monad.Reader (ReaderT, runReaderT, ask) import Control.Monad.Trans (MonadTrans, lift) import Control.Monad.Trans.Maybe (MaybeT(..), runMaybeT)-import System.IO.Error (tryIOError) - instance Exception () -- | The 'Failable' class. A Monad which is an instance of this class can be used as a context@@ -212,5 +209,7 @@ -- failableIO :: (Failable m, MonadIO m) => IO a -> m a failableIO actions = do- result <- liftIO . tryIOError $ actions+ result :: Either SomeException a <- liftIO $ tryActions `catch` someError either failure return result+ where tryActions = actions >>= return . Right+ someError = return . Left