| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
PlutusCore.Evaluation.Error
Description
The exceptions that an abstract machine can throw.
Synopsis
- data EvaluationError structural operational
- = StructuralError !structural
- | OperationalError !operational
Documentation
data EvaluationError structural operational Source #
The type of errors that can occur during evaluation. There are two kinds of errors:
- Structural ones -- these are errors that are indicative of the _structure_ of the program being
wrong. For example, a free variable was encountered during evaluation, a non-function was
applied to an argument or
tailListwas applied to a non-list. - Operational ones -- these are errors that are indicative of the _logic_ of the program being
wrong. For example,
errorwas executed,tailListwas applied to an empty list or evaluation ran out of gas.
On the chain both of these are just regular failures and we don't distinguish between them there: if a script fails, it fails, it doesn't matter what the reason was. However in the tests it does matter why the failure occurred: a structural error may indicate that the test was written incorrectly while an operational error may be entirely expected.
In other words, structural errors are "runtime type errors" and operational errors are regular runtime errors. Which means that evaluating an (erased) well-typed program should never produce a structural error, only an operational one. This creates a sort of "runtime type system" for UPLC and it would be great to stick to it and enforce in tests etc, but we currently don't.
Constructors
| StructuralError !structural | |
| OperationalError !operational |
Instances
| Bifoldable EvaluationError Source # | |||||
Defined in PlutusCore.Evaluation.Error Methods bifold :: Monoid m => EvaluationError m m -> m Source # bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> EvaluationError a b -> m Source # bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> EvaluationError a b -> c Source # bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> EvaluationError a b -> c Source # | |||||
| Bifunctor EvaluationError Source # | |||||
Defined in PlutusCore.Evaluation.Error Methods bimap :: (a -> b) -> (c -> d) -> EvaluationError a c -> EvaluationError b d Source # first :: (a -> b) -> EvaluationError a c -> EvaluationError b c Source # second :: (b -> c) -> EvaluationError a b -> EvaluationError a c Source # | |||||
| Bitraversable EvaluationError Source # | |||||
Defined in PlutusCore.Evaluation.Error Methods bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> EvaluationError a b -> f (EvaluationError c d) Source # | |||||
| (HasPrettyDefaults config ~ 'True, PrettyBy config structural, Pretty operational) => PrettyBy config (EvaluationError structural operational) Source # | |||||
Defined in PlutusCore.Evaluation.Error Methods prettyBy :: config -> EvaluationError structural operational -> Doc ann # prettyListBy :: config -> [EvaluationError structural operational] -> Doc ann # | |||||
| Functor (EvaluationError structural) Source # | |||||
Defined in PlutusCore.Evaluation.Error Methods fmap :: (a -> b) -> EvaluationError structural a -> EvaluationError structural b Source # (<$) :: a -> EvaluationError structural b -> EvaluationError structural a Source # | |||||
| Generic (EvaluationError structural operational) Source # | |||||
Defined in PlutusCore.Evaluation.Error Associated Types
Methods from :: EvaluationError structural operational -> Rep (EvaluationError structural operational) x Source # to :: Rep (EvaluationError structural operational) x -> EvaluationError structural operational Source # | |||||
| (Show structural, Show operational) => Show (EvaluationError structural operational) Source # | |||||
Defined in PlutusCore.Evaluation.Error | |||||
| (NFData structural, NFData operational) => NFData (EvaluationError structural operational) Source # | |||||
Defined in PlutusCore.Evaluation.Error Methods rnf :: EvaluationError structural operational -> () Source # | |||||
| (Eq structural, Eq operational) => Eq (EvaluationError structural operational) Source # | |||||
Defined in PlutusCore.Evaluation.Error Methods (==) :: EvaluationError structural operational -> EvaluationError structural operational -> Bool Source # (/=) :: EvaluationError structural operational -> EvaluationError structural operational -> Bool Source # | |||||
| (Pretty structural, Pretty operational) => Pretty (EvaluationError structural operational) Source # | |||||
Defined in PlutusCore.Evaluation.Error Methods pretty :: EvaluationError structural operational -> Doc ann # prettyList :: [EvaluationError structural operational] -> Doc ann # | |||||
| ThrowableBuiltins uni fun => MonadError (CekEvaluationException NamedDeBruijn uni fun) (CekM uni fun s) Source # | |||||
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 (EvaluationError structural operational) Source # | |||||
Defined in PlutusCore.Evaluation.Error type Rep (EvaluationError structural operational) = D1 ('MetaData "EvaluationError" "PlutusCore.Evaluation.Error" "plutus-core-1.60.0.0-LXFqBsoUlXsJIEqLytHte7" 'False) (C1 ('MetaCons "StructuralError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 structural)) :+: C1 ('MetaCons "OperationalError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 operational))) | |||||