plutus-core-1.0.0.1: Language library for Plutus Core
Safe Haskell None
Language Haskell2010

PlutusCore.Evaluation.Machine.Exception

Description

The exceptions that an abstract machine can throw.

Synopsis

Documentation

newtype UnliftingError Source #

When unlifting of a PLC term into a Haskell value fails, this error is thrown.

Instances

Instances details
Eq UnliftingError Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

Show UnliftingError Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

IsString UnliftingError Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

Semigroup UnliftingError Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

NFData UnliftingError Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

Pretty UnliftingError Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

HasErrorCode UnliftingError Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

AsUnliftingError UnliftingError Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

data MachineError fun Source #

Errors which can occur during a run of an abstract machine.

Constructors

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 ConstAppError .

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

Instances details
Functor MachineError Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

( HasPrettyDefaults config ~ ' True , Pretty fun) => PrettyBy config ( MachineError fun) Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

Eq fun => Eq ( MachineError fun) Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

Show fun => Show ( MachineError fun) Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

Generic ( MachineError fun) Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

Associated Types

type Rep ( MachineError fun) :: Type -> Type Source #

NFData fun => NFData ( MachineError fun) Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

HasErrorCode ( MachineError err) Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

AsUnliftingError ( MachineError fun) Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

AsMachineError ( MachineError fun) fun Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

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

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

type Rep ( MachineError fun) Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

type Rep ( MachineError fun) = D1 (' MetaData "MachineError" "PlutusCore.Evaluation.Machine.Exception" "plutus-core-1.0.0.1-76bWF9ZEWyb4eDyjHx0kCS" ' False ) ((( C1 (' MetaCons "NonPolymorphicInstantiationMachineError" ' PrefixI ' False ) ( U1 :: Type -> Type ) :+: C1 (' MetaCons "NonWrapUnwrappedMachineError" ' PrefixI ' False ) ( U1 :: Type -> Type )) :+: ( C1 (' MetaCons "NonFunctionalApplicationMachineError" ' PrefixI ' False ) ( U1 :: Type -> Type ) :+: C1 (' MetaCons "OpenTermEvaluatedMachineError" ' PrefixI ' False ) ( U1 :: Type -> Type ))) :+: (( C1 (' MetaCons "UnliftingMachineError" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 UnliftingError )) :+: C1 (' MetaCons "BuiltinTermArgumentExpectedMachineError" ' PrefixI ' False ) ( U1 :: Type -> Type )) :+: ( C1 (' MetaCons "UnexpectedBuiltinTermArgumentMachineError" ' PrefixI ' False ) ( U1 :: Type -> Type ) :+: ( C1 (' MetaCons "EmptyBuiltinArityMachineError" ' PrefixI ' False ) ( U1 :: Type -> Type ) :+: C1 (' MetaCons "UnknownBuiltin" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 fun))))))

class AsMachineError r fun | r -> fun where Source #

Minimal complete definition

_MachineError

Instances

Instances details
AsMachineError ( MachineError fun) fun Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

internal ~ MachineError fun => AsMachineError ( EvaluationError user internal) fun Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

data EvaluationError user internal Source #

The type of errors (all of them) which can occur during evaluation (some are used-caused, some are internal).

Constructors

InternalEvaluationError internal

Indicates bugs.

UserEvaluationError user

Indicates user errors.

Instances

Instances details
( HasPrettyDefaults config ~ ' True , PrettyBy config internal, Pretty user) => PrettyBy config ( EvaluationError user internal) Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

Methods

prettyBy :: config -> EvaluationError user internal -> Doc ann Source #

prettyListBy :: config -> [ EvaluationError user internal] -> Doc ann Source #

Functor ( EvaluationError user) Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

( Eq internal, Eq user) => Eq ( EvaluationError user internal) Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

( Show internal, Show user) => Show ( EvaluationError user internal) Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

Generic ( EvaluationError user internal) Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

Associated Types

type Rep ( EvaluationError user internal) :: Type -> Type Source #

Methods

from :: EvaluationError user internal -> Rep ( EvaluationError user internal) x Source #

to :: Rep ( EvaluationError user internal) x -> EvaluationError user internal Source #

( NFData internal, NFData user) => NFData ( EvaluationError user internal) Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

Methods

rnf :: EvaluationError user internal -> () Source #

( HasErrorCode user, HasErrorCode internal) => HasErrorCode ( EvaluationError user internal) Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

AsEvaluationFailure user => AsEvaluationFailure ( EvaluationError user internal) Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

AsUnliftingError internal => AsUnliftingError ( EvaluationError user internal) Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

internal ~ MachineError fun => AsMachineError ( EvaluationError user internal) fun Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

AsEvaluationError ( EvaluationError user internal) user internal Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

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

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

type Rep ( EvaluationError user internal) Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

type Rep ( EvaluationError user internal) = D1 (' MetaData "EvaluationError" "PlutusCore.Evaluation.Machine.Exception" "plutus-core-1.0.0.1-76bWF9ZEWyb4eDyjHx0kCS" ' False ) ( C1 (' MetaCons "InternalEvaluationError" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 internal)) :+: C1 (' MetaCons "UserEvaluationError" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 user)))

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.Machine.Exception

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

Defined in PlutusCore.Evaluation.Machine.Exception

Methods

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

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

Functor ( ErrorWithCause err) Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

Foldable ( ErrorWithCause err) Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

Traversable ( ErrorWithCause err) Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

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

Defined in PlutusCore.Evaluation.Machine.Exception

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

Defined in PlutusCore.Evaluation.Machine.Exception

Generic ( ErrorWithCause err cause) Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

Associated Types

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

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

Defined in PlutusCore.Evaluation.Machine.Exception

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

Defined in PlutusCore.Evaluation.Machine.Exception

Methods

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

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

Defined in PlutusCore.Evaluation.Machine.Exception

HasErrorCode err => HasErrorCode ( ErrorWithCause err t) Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

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

Defined in PlutusCore.Evaluation.Machine.Exception

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

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

type Rep ( ErrorWithCause err cause) Source #
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

type Rep ( ErrorWithCause err cause) = D1 (' MetaData "ErrorWithCause" "PlutusCore.Evaluation.Machine.Exception" "plutus-core-1.0.0.1-76bWF9ZEWyb4eDyjHx0kCS" ' False ) ( C1 (' MetaCons "ErrorWithCause" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "_ewcError") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 err) :*: S1 (' MetaSel (' Just "_ewcCause") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( Maybe cause))))

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 ''MyError
throwing_ _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.