Safe Haskell | None |
---|---|
Language | Haskell2010 |
The exceptions that an abstract machine can throw.
Synopsis
- newtype UnliftingError = UnliftingErrorE Text
- class AsUnliftingError r where
-
data
MachineError
fun
- = NonPolymorphicInstantiationMachineError
- | NonWrapUnwrappedMachineError
- | NonFunctionalApplicationMachineError
- | OpenTermEvaluatedMachineError
- | UnliftingMachineError UnliftingError
- | BuiltinTermArgumentExpectedMachineError
- | UnexpectedBuiltinTermArgumentMachineError
- | EmptyBuiltinArityMachineError
- | UnknownBuiltin fun
-
class
AsMachineError
r fun | r -> fun
where
- _MachineError :: Prism' r ( MachineError fun)
- _NonPolymorphicInstantiationMachineError :: Prism' r ()
- _NonWrapUnwrappedMachineError :: Prism' r ()
- _NonFunctionalApplicationMachineError :: Prism' r ()
- _OpenTermEvaluatedMachineError :: Prism' r ()
- _UnliftingMachineError :: Prism' r UnliftingError
- _BuiltinTermArgumentExpectedMachineError :: Prism' r ()
- _UnexpectedBuiltinTermArgumentMachineError :: Prism' r ()
- _EmptyBuiltinArityMachineError :: Prism' r ()
- _UnknownBuiltin :: Prism' r fun
-
data
EvaluationError
user internal
- = InternalEvaluationError internal
- | UserEvaluationError user
-
class
AsEvaluationError
r user internal | r -> user internal
where
- _EvaluationError :: Prism' r ( EvaluationError user internal)
- _InternalEvaluationError :: Prism' r internal
- _UserEvaluationError :: Prism' r user
- data ErrorWithCause err cause = ErrorWithCause { }
- type EvaluationException user internal = ErrorWithCause ( EvaluationError user internal)
- mapCauseInMachineException :: (term1 -> term2) -> EvaluationException user ( MachineError fun) term1 -> EvaluationException user ( MachineError fun) term2
- throwing_ :: MonadError e m => AReview e () -> m x
- throwingWithCause :: forall exc e t term m x. (exc ~ ErrorWithCause e term, MonadError exc m) => AReview e t -> t -> Maybe term -> m x
- extractEvaluationResult :: Either ( EvaluationException user internal term) a -> Either ( ErrorWithCause internal term) ( EvaluationResult a)
- unsafeExtractEvaluationResult :: ( PrettyPlc internal, PrettyPlc term, Typeable internal, Typeable term) => Either ( EvaluationException user internal term) a -> EvaluationResult a
Documentation
newtype UnliftingError Source #
When unlifting of a PLC term into a Haskell value fails, this error is thrown.
Instances
class AsUnliftingError r where Source #
_UnliftingError :: Prism' r UnliftingError Source #
_UnliftingErrorE :: Prism' r Text Source #
Instances
AsUnliftingError UnliftingError Source # | |
AsUnliftingError KnownTypeError Source # | |
AsUnliftingError ( MachineError fun) Source # | |
Defined in PlutusCore.Evaluation.Machine.Exception _UnliftingError :: Prism' ( MachineError fun) UnliftingError Source # _UnliftingErrorE :: Prism' ( MachineError fun) Text Source # |
|
AsUnliftingError internal => AsUnliftingError ( EvaluationError user internal) Source # | |
Defined in PlutusCore.Evaluation.Machine.Exception _UnliftingError :: Prism' ( EvaluationError user internal) UnliftingError Source # _UnliftingErrorE :: Prism' ( EvaluationError user internal) Text Source # |
data MachineError fun Source #
Errors which can occur during a run of an abstract machine.
NonPolymorphicInstantiationMachineError |
An attempt to reduce a not immediately reducible type instantiation. |
NonWrapUnwrappedMachineError |
An attempt to unwrap a not wrapped term. |
NonFunctionalApplicationMachineError |
An attempt to reduce a not immediately reducible application. |
OpenTermEvaluatedMachineError |
An attempt to evaluate an open term. |
UnliftingMachineError UnliftingError |
An attempt to compute a constant application resulted in
|
BuiltinTermArgumentExpectedMachineError |
A builtin expected a term argument, but something else was received |
UnexpectedBuiltinTermArgumentMachineError |
A builtin received a term argument when something else was expected |
EmptyBuiltinArityMachineError |
We've reached a state where a builtin instantiation or application is attempted when the arity is zero. In the absence of nullary builtins, this should be impossible. See the machine implementations for details. |
UnknownBuiltin fun |
Instances
class AsMachineError r fun | r -> fun where Source #
_MachineError :: Prism' r ( MachineError fun) Source #
_NonPolymorphicInstantiationMachineError :: Prism' r () Source #
_NonWrapUnwrappedMachineError :: Prism' r () Source #
_NonFunctionalApplicationMachineError :: Prism' r () Source #
_OpenTermEvaluatedMachineError :: Prism' r () Source #
_UnliftingMachineError :: Prism' r UnliftingError Source #
_BuiltinTermArgumentExpectedMachineError :: Prism' r () Source #
_UnexpectedBuiltinTermArgumentMachineError :: Prism' r () Source #
_EmptyBuiltinArityMachineError :: Prism' r () Source #
_UnknownBuiltin :: Prism' r fun Source #
Instances
data EvaluationError user internal Source #
The type of errors (all of them) which can occur during evaluation (some are used-caused, some are internal).
InternalEvaluationError internal |
Indicates bugs. |
UserEvaluationError user |
Indicates user errors. |
Instances
class AsEvaluationError r user internal | r -> user internal where Source #
_EvaluationError :: Prism' r ( EvaluationError user internal) Source #
_InternalEvaluationError :: Prism' r internal Source #
_UserEvaluationError :: Prism' r user Source #
Instances
AsEvaluationError ( EvaluationError user internal) user internal Source # | |
Defined in PlutusCore.Evaluation.Machine.Exception _EvaluationError :: Prism' ( EvaluationError user internal) ( EvaluationError user internal) Source # _InternalEvaluationError :: Prism' ( EvaluationError user internal) internal Source # _UserEvaluationError :: Prism' ( EvaluationError user internal) user Source # |
data ErrorWithCause err cause Source #
An error and (optionally) what caused it.
Instances
type EvaluationException user internal = ErrorWithCause ( EvaluationError user internal) Source #
mapCauseInMachineException :: (term1 -> term2) -> EvaluationException user ( MachineError fun) term1 -> EvaluationException user ( MachineError fun) term2 Source #
throwing_ :: MonadError e m => AReview e () -> m x Source #
Similar to
throwing
but specialised for the common case of
error constructors with no arguments.
data MyError = Foo | Bar makePrisms ''MyErrorthrowing_
_Foo ::MonadError
MyError m => m a
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.
extractEvaluationResult :: Either ( EvaluationException user internal term) a -> Either ( ErrorWithCause internal term) ( EvaluationResult a) Source #
Turn any
UserEvaluationError
into an
EvaluationFailure
.
unsafeExtractEvaluationResult :: ( PrettyPlc internal, PrettyPlc term, Typeable internal, Typeable term) => Either ( EvaluationException user internal term) a -> EvaluationResult a Source #