Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
The exceptions that an abstract machine can throw.
Synopsis
- data EvaluationError structural operational
- = StructuralEvaluationError !structural
- | OperationalEvaluationError !operational
- class AsEvaluationError r structural operational | r -> structural operational where
- _EvaluationError :: Prism' r (EvaluationError structural operational)
- _StructuralEvaluationError :: Prism' r structural
- _OperationalEvaluationError :: Prism' r 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
tailList
was applied to a non-list. - Operational ones -- these are errors that are indicative of the _logic_ of the program being
wrong. For example,
error
was executed,tailList
was 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.
StructuralEvaluationError !structural | |
OperationalEvaluationError !operational |
Instances
class AsEvaluationError r structural operational | r -> structural operational where Source #
_EvaluationError :: Prism' r (EvaluationError structural operational) Source #
_StructuralEvaluationError :: Prism' r structural Source #
_OperationalEvaluationError :: Prism' r operational Source #
Instances
AsEvaluationError UnliftingEvaluationError UnliftingError UnliftingError Source # | |
Defined in PlutusCore.Builtin.Result | |
AsEvaluationError (EvaluationError structural operational) structural operational Source # | |
Defined in PlutusCore.Evaluation.Error _EvaluationError :: Prism' (EvaluationError structural operational) (EvaluationError structural operational) Source # _StructuralEvaluationError :: Prism' (EvaluationError structural operational) structural Source # _OperationalEvaluationError :: Prism' (EvaluationError structural operational) operational Source # |