HORIZON HASKELLDocslts/ghc-9.14.xd82dee82026-10-12Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · d82dee8 · 2026-10-12

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
valueerrorFail :: HasCallStack => Fail a -> a
#

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.

valueerrorFailWithoutStackTrace :: Fail a -> a
#

Version of errorFailWithoutStackTrace restricted to Text

Same as errorFail, but without the stack trace:

Example3 expressions
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"
valuemapErrorsFailT :: Functor m => ([e] -> [Text]) -> FailT e m a -> FailT m a
#

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:

Example1 expression
runFail (mapErrorsFailT (const [] :: [Text] -> [Text]) $ fail "Something went wrong" >> pure ())Left "No failure reason given"