ModuleFailT-0.1.2.0Haskell2010
Control.Monad.Trans.Fail.Text
This module contains a synonym for FailT e m a transformer, where failure
type e is restricted to Text. All functions in this module have the same
names and are a drop-in replacement for Control.Monad.Trans.Fail module, except with
monomorphic failure type.
- 3 types
- 17 values
- PackageFailT-0.1.2.0
- Exports20
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceText.hs
Version of runFailLast restricted to Text
Version of runFailAgg restricted to Text
Version of errorFail restricted to Text
Throw an error if there was a failure, otherwise return the result of monadic computation. Use throwFailT in case you'd like to handle an actual exception.
Version of errorFailWithoutStackTrace restricted to Text
Same as errorFail, but without the stack trace:
errorFailWithoutStackTrace (fail "This didn't work" :: Fail ())*** Exception: "This didn't work"import Control.ApplicativeerrorFailWithoutStackTrace (fail "This didn't work" <|> pure "That Worked" :: Fail String)"That Worked"
An exception that is produced by the FailT monad transformer.
Constructors
FailException :: (Typeable e, Show e) => [e] -> CallStack -> FailExceptionfailMessages :: [e]failCallStack :: CallStack
Instances2Show, Exception
Show FailExceptionDefined in FailT-0.1.2.0 · Control.Monad.Trans.FailException FailExceptionDefined in FailT-0.1.2.0 · Control.Monad.Trans.Fail
Version of runFailLastT restricted to Text
Version of runFailAggT restricted to Text
Version of hoistFailT restricted to Text
Change the underlying monad with the hoisting function
Version of mapErrorFailT where resulting type is restricted to Text
Map a function over the error type in the FailT monad.
Version of F.mapErrorsFail, where resulting type is restricted to Text
Map a function over the aggregation of errors in the FailT monad. Could be used for example for clearing our all of the aggregated error messages:
runFail (mapErrorsFailT (const [] :: [Text] -> [Text]) $ fail "Something went wrong" >> pure ())Left "No failure reason given"
Version of exceptFailT restricted to Text
Version of throwErrorFailT restricted to Text
Same as exceptFailT, but works with any MonadError.
import Control.Monad.Trans.Fail.TextthrowErrorFailT (fail "A bad thing" >> pure () :: FailT (Except FailException) ())ExceptT (Identity (Left FailException"A bad thing"CallStack (from HasCallStack):...
Version of throwFailT restricted to Text