Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data ErrorWithCause err cause = ErrorWithCause {}
- throwingWithCause :: forall exc e t term m x. (exc ~ ErrorWithCause e term, MonadError exc m) => AReview e t -> t -> Maybe term -> m x
- throwingWithCause_ :: forall exc e term m x. (exc ~ ErrorWithCause e term, MonadError exc m) => AReview e () -> Maybe term -> m x
- throwBuiltinErrorWithCause :: (MonadError (ErrorWithCause err cause) m, AsUnliftingEvaluationError err, AsEvaluationFailure err) => cause -> BuiltinError -> m void
Documentation
data ErrorWithCause err cause Source #
An error and (optionally) what caused it.
Instances
throwingWithCause :: forall exc e t term m x. (exc ~ ErrorWithCause e term, MonadError exc m) => AReview e t -> t -> Maybe term -> m x Source #
Prismatically throw an error and its (optional) cause.
throwingWithCause_ :: forall exc e term m x. (exc ~ ErrorWithCause e term, MonadError exc m) => AReview e () -> Maybe term -> m x Source #
Prismatically throw a contentless error and its (optional) cause. throwingWithCause_
is to
throwingWithCause
as throwing_
is to throwing
.
throwBuiltinErrorWithCause :: (MonadError (ErrorWithCause err cause) m, AsUnliftingEvaluationError err, AsEvaluationFailure err) => cause -> BuiltinError -> m void Source #
Attach a cause
to a BuiltinError
and throw that.
Note that an evaluator might require the cause to be computed lazily for best performance on the
happy path, hence this function must not force its first argument.
TODO: wrap cause
in Lazy
once we have it.