plutus-core-1.36.0.0: Language library for Plutus Core
Safe HaskellSafe-Inferred
LanguageHaskell2010

PlutusCore.Evaluation.ErrorWithCause

Synopsis

Documentation

data ErrorWithCause err cause Source #

An error and (optionally) what caused it.

Constructors

ErrorWithCause 

Fields

Instances

Instances details
Bifunctor ErrorWithCause Source # 
Instance details

Defined in PlutusCore.Evaluation.ErrorWithCause

Methods

bimap :: (a -> b) -> (c -> d) -> ErrorWithCause a c -> ErrorWithCause b d Source #

first :: (a -> b) -> ErrorWithCause a c -> ErrorWithCause b c Source #

second :: (b -> c) -> ErrorWithCause a b -> ErrorWithCause a c Source #

(PrettyBy config cause, PrettyBy config err) => PrettyBy config (ErrorWithCause err cause) Source # 
Instance details

Defined in PlutusCore.Evaluation.ErrorWithCause

Methods

prettyBy :: config -> ErrorWithCause err cause -> Doc ann #

prettyListBy :: config -> [ErrorWithCause err cause] -> Doc ann #

Foldable (ErrorWithCause err) Source # 
Instance details

Defined in PlutusCore.Evaluation.ErrorWithCause

Methods

fold :: Monoid m => ErrorWithCause err m -> m Source #

foldMap :: Monoid m => (a -> m) -> ErrorWithCause err a -> m Source #

foldMap' :: Monoid m => (a -> m) -> ErrorWithCause err a -> m Source #

foldr :: (a -> b -> b) -> b -> ErrorWithCause err a -> b Source #

foldr' :: (a -> b -> b) -> b -> ErrorWithCause err a -> b Source #

foldl :: (b -> a -> b) -> b -> ErrorWithCause err a -> b Source #

foldl' :: (b -> a -> b) -> b -> ErrorWithCause err a -> b Source #

foldr1 :: (a -> a -> a) -> ErrorWithCause err a -> a Source #

foldl1 :: (a -> a -> a) -> ErrorWithCause err a -> a Source #

toList :: ErrorWithCause err a -> [a] Source #

null :: ErrorWithCause err a -> Bool Source #

length :: ErrorWithCause err a -> Int Source #

elem :: Eq a => a -> ErrorWithCause err a -> Bool Source #

maximum :: Ord a => ErrorWithCause err a -> a Source #

minimum :: Ord a => ErrorWithCause err a -> a Source #

sum :: Num a => ErrorWithCause err a -> a Source #

product :: Num a => ErrorWithCause err a -> a Source #

Traversable (ErrorWithCause err) Source # 
Instance details

Defined in PlutusCore.Evaluation.ErrorWithCause

Methods

traverse :: Applicative f => (a -> f b) -> ErrorWithCause err a -> f (ErrorWithCause err b) Source #

sequenceA :: Applicative f => ErrorWithCause err (f a) -> f (ErrorWithCause err a) Source #

mapM :: Monad m => (a -> m b) -> ErrorWithCause err a -> m (ErrorWithCause err b) Source #

sequence :: Monad m => ErrorWithCause err (m a) -> m (ErrorWithCause err a) Source #

Functor (ErrorWithCause err) Source # 
Instance details

Defined in PlutusCore.Evaluation.ErrorWithCause

Methods

fmap :: (a -> b) -> ErrorWithCause err a -> ErrorWithCause err b Source #

(<$) :: a -> ErrorWithCause err b -> ErrorWithCause err a Source #

(PrettyPlc cause, PrettyPlc err, Typeable cause, Typeable err) => Exception (ErrorWithCause err cause) Source # 
Instance details

Defined in PlutusCore.Evaluation.ErrorWithCause

Generic (ErrorWithCause err cause) Source # 
Instance details

Defined in PlutusCore.Evaluation.ErrorWithCause

Associated Types

type Rep (ErrorWithCause err cause) :: Type -> Type Source #

Methods

from :: ErrorWithCause err cause -> Rep (ErrorWithCause err cause) x Source #

to :: Rep (ErrorWithCause err cause) x -> ErrorWithCause err cause Source #

(PrettyPlc cause, PrettyPlc err) => Show (ErrorWithCause err cause) Source # 
Instance details

Defined in PlutusCore.Evaluation.ErrorWithCause

Methods

showsPrec :: Int -> ErrorWithCause err cause -> ShowS Source #

show :: ErrorWithCause err cause -> String Source #

showList :: [ErrorWithCause err cause] -> ShowS Source #

(NFData err, NFData cause) => NFData (ErrorWithCause err cause) Source # 
Instance details

Defined in PlutusCore.Evaluation.ErrorWithCause

Methods

rnf :: ErrorWithCause err cause -> () Source #

(Eq err, Eq cause) => Eq (ErrorWithCause err cause) Source # 
Instance details

Defined in PlutusCore.Evaluation.ErrorWithCause

Methods

(==) :: ErrorWithCause err cause -> ErrorWithCause err cause -> Bool Source #

(/=) :: ErrorWithCause err cause -> ErrorWithCause err cause -> Bool Source #

AsEvaluationFailure err => AsEvaluationFailure (ErrorWithCause err cause) Source # 
Instance details

Defined in PlutusCore.Evaluation.ErrorWithCause

Methods

_EvaluationFailure :: Prism' (ErrorWithCause err cause) () Source #

(Pretty err, Pretty cause) => Pretty (ErrorWithCause err cause) Source # 
Instance details

Defined in PlutusCore.Evaluation.ErrorWithCause

Methods

pretty :: ErrorWithCause err cause -> Doc ann #

prettyList :: [ErrorWithCause err cause] -> Doc ann #

ThrowableBuiltins uni fun => MonadError (CekEvaluationException NamedDeBruijn uni fun) (CekM uni fun s) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

throwError :: CekEvaluationException NamedDeBruijn uni fun -> CekM uni fun s a Source #

catchError :: CekM uni fun s a -> (CekEvaluationException NamedDeBruijn uni fun -> CekM uni fun s a) -> CekM uni fun s a Source #

type Rep (ErrorWithCause err cause) Source # 
Instance details

Defined in PlutusCore.Evaluation.ErrorWithCause

type Rep (ErrorWithCause err cause) = D1 ('MetaData "ErrorWithCause" "PlutusCore.Evaluation.ErrorWithCause" "plutus-core-1.36.0.0-7ehJj5tIPqoJIiiivXkX9N" 'False) (C1 ('MetaCons "ErrorWithCause" 'PrefixI 'True) (S1 ('MetaSel ('Just "_ewcError") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 err) :*: S1 ('MetaSel ('Just "_ewcCause") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe cause))))

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.