plutus-core-1.0.0.1: Language library for Plutus Core
Safe HaskellNone
LanguageHaskell2010

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.

Constructors

UnliftingErrorE Text 

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

Methods

rnf :: UnliftingError -> () Source #

Pretty UnliftingError Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

Methods

pretty :: UnliftingError -> Doc ann #

prettyList :: [UnliftingError] -> Doc ann #

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

Methods

fmap :: (a -> b) -> MachineError a -> MachineError b Source #

(<$) :: a -> MachineError b -> MachineError a Source #

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

Defined in PlutusCore.Evaluation.Machine.Exception

Methods

prettyBy :: config -> MachineError fun -> Doc ann #

prettyListBy :: config -> [MachineError fun] -> Doc ann #

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 #

Methods

from :: MachineError fun -> Rep (MachineError fun) x Source #

to :: Rep (MachineError fun) x -> MachineError fun Source #

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

Defined in PlutusCore.Evaluation.Machine.Exception

Methods

rnf :: MachineError fun -> () Source #

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) 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

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

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

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-6wMiyL0yerXJu56t8zBoKx" '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 #

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

Functor (EvaluationError user) Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

Methods

fmap :: (a -> b) -> EvaluationError user a -> EvaluationError user b Source #

(<$) :: a -> EvaluationError user b -> EvaluationError user a Source #

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

Defined in PlutusCore.Evaluation.Machine.Exception

Methods

(==) :: EvaluationError user internal -> EvaluationError user internal -> Bool Source #

(/=) :: EvaluationError user internal -> EvaluationError user internal -> Bool Source #

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

Defined in PlutusCore.Evaluation.Machine.Exception

Methods

showsPrec :: Int -> EvaluationError user internal -> ShowS Source #

show :: EvaluationError user internal -> String Source #

showList :: [EvaluationError user internal] -> ShowS Source #

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

Methods

errorCode :: EvaluationError user internal -> ErrorCode Source #

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

Defined in PlutusCore.Evaluation.Machine.Exception

Methods

_EvaluationFailure :: Prism' (EvaluationError user internal) () Source #

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

Defined in PlutusCore.Evaluation.Machine.Exception

Methods

_UnliftingError :: Prism' (EvaluationError user internal) UnliftingError Source #

_UnliftingErrorE :: Prism' (EvaluationError user internal) Text Source #

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

Methods

_EvaluationError :: Prism' (EvaluationError user internal) (EvaluationError user internal) Source #

_InternalEvaluationError :: Prism' (EvaluationError user internal) internal Source #

_UserEvaluationError :: Prism' (EvaluationError user internal) user Source #

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

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

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

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

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-6wMiyL0yerXJu56t8zBoKx" '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)))

class AsEvaluationError r user internal | r -> user internal where Source #

Minimal complete definition

_EvaluationError

Methods

_EvaluationError :: Prism' r (EvaluationError user internal) Source #

_InternalEvaluationError :: Prism' r internal Source #

_UserEvaluationError :: Prism' r user Source #

Instances

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

Defined in PlutusCore.Evaluation.Machine.Exception

Methods

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

Constructors

ErrorWithCause 

Fields

Instances

Instances details
Bifunctor ErrorWithCause Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

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

Methods

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

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

Functor (ErrorWithCause err) Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

Methods

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

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

Foldable (ErrorWithCause err) Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

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

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 #

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

Defined in PlutusCore.Evaluation.Machine.Exception

Methods

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

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

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

Defined in PlutusCore.Evaluation.Machine.Exception

Methods

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

show :: ErrorWithCause err cause -> String Source #

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

Generic (ErrorWithCause err cause) Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

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, 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

Methods

pretty :: ErrorWithCause err cause -> Doc ann #

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

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

Methods

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

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

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

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

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

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-6wMiyL0yerXJu56t8zBoKx" '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))))

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 #

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.

unsafeExtractEvaluationResult :: (PrettyPlc internal, PrettyPlc term, Typeable internal, Typeable term) => Either (EvaluationException user internal term) a -> EvaluationResult a Source #