plutus-core-1.34.1.0: Language library for Plutus Core
Safe HaskellSafe-Inferred
LanguageHaskell2010

UntypedPlutusCore.Evaluation.Machine.SteppableCek.Internal

Description

The CEK machine. The CEK machine relies on variables having non-equal Uniques whenever they have non-equal string names. I.e. Uniques are used instead of string names. This is for efficiency reasons. The CEK machines handles name capture by design.

Synopsis

Documentation

data CekState uni fun ann Source #

Constructors

Starting (NTerm uni fun ann) 
Computing (Context uni fun ann) (CekValEnv uni fun ann) (NTerm uni fun ann) 
Returning (Context uni fun ann) (CekValue uni fun ann) 
Terminating (NTerm uni fun ()) 

Instances

Instances details
Pretty (CekState uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.SteppableCek.Internal

Methods

prettyCekState uni fun ann → Doc ann0 Source #

prettyList ∷ [CekState uni fun ann] → Doc ann0 Source #

data Context uni fun ann Source #

Similar to Context, but augmented with an ann

Constructors

FrameAwaitArg ann !(CekValue uni fun ann) !(Context uni fun ann)
[V _]
FrameAwaitFunTerm ann !(CekValEnv uni fun ann) !(NTerm uni fun ann) !(Context uni fun ann)
[_ N]
FrameAwaitFunValue ann !(CekValue uni fun ann) !(Context uni fun ann) 
FrameForce ann !(Context uni fun ann)
(force _)
FrameConstr ann !(CekValEnv uni fun ann) !Word64 ![NTerm uni fun ann] !(ArgStack uni fun ann) !(Context uni fun ann) 
FrameCases ann !(CekValEnv uni fun ann) !(Vector (NTerm uni fun ann)) !(Context uni fun ann) 
NoFrame 

Instances

Instances details
(GShow uni, Everywhere uni Show, Show fun, Show ann, Closed uni) ⇒ Show (Context uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.SteppableCek.Internal

Methods

showsPrecIntContext uni fun ann → ShowS Source #

showContext uni fun ann → String Source #

showList ∷ [Context uni fun ann] → ShowS Source #

contextAnnContext uni fun ann → Maybe ann Source #

liftCek ∷ (PrimMonad m, PrimState m ~ s) ⇒ CekM uni fun s a → m a Source #

Lift a CEK computation to a primitive.PrimMonad m

class Monad m ⇒ PrimMonad (m ∷ TypeType) where Source #

Class of monads which can perform primitive state-transformer actions.

Associated Types

type PrimState (m ∷ TypeType) Source #

State token type.

Methods

primitive ∷ (State# (PrimState m) → (# State# (PrimState m), a #)) → m a Source #

Execute a primitive operation.

Instances

Instances details
PrimMonad IO 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState IO Source #

Methods

primitive ∷ (State# (PrimState IO) → (# State# (PrimState IO), a #)) → IO a Source #

PrimMonad (ST s) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (ST s) Source #

Methods

primitive ∷ (State# (PrimState (ST s)) → (# State# (PrimState (ST s)), a #)) → ST s a Source #

PrimMonad (ST s) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (ST s) Source #

Methods

primitive ∷ (State# (PrimState (ST s)) → (# State# (PrimState (ST s)), a #)) → ST s a Source #

PrimMonad m ⇒ PrimMonad (GenT m) 
Instance details

Defined in Hedgehog.Internal.Gen

Associated Types

type PrimState (GenT m) Source #

Methods

primitive ∷ (State# (PrimState (GenT m)) → (# State# (PrimState (GenT m)), a #)) → GenT m a Source #

PrimMonad m ⇒ PrimMonad (PropertyT m) 
Instance details

Defined in Hedgehog.Internal.Property

Associated Types

type PrimState (PropertyT m) Source #

Methods

primitive ∷ (State# (PrimState (PropertyT m)) → (# State# (PrimState (PropertyT m)), a #)) → PropertyT m a Source #

PrimMonad m ⇒ PrimMonad (TestT m) 
Instance details

Defined in Hedgehog.Internal.Property

Associated Types

type PrimState (TestT m) Source #

Methods

primitive ∷ (State# (PrimState (TestT m)) → (# State# (PrimState (TestT m)), a #)) → TestT m a Source #

PrimMonad m ⇒ PrimMonad (TreeT m) 
Instance details

Defined in Hedgehog.Internal.Tree

Associated Types

type PrimState (TreeT m) Source #

Methods

primitive ∷ (State# (PrimState (TreeT m)) → (# State# (PrimState (TreeT m)), a #)) → TreeT m a Source #

PrimMonad m ⇒ PrimMonad (ResourceT m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Associated Types

type PrimState (ResourceT m) Source #

Methods

primitive ∷ (State# (PrimState (ResourceT m)) → (# State# (PrimState (ResourceT m)), a #)) → ResourceT m a Source #

PrimMonad m ⇒ PrimMonad (MaybeT m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (MaybeT m) Source #

Methods

primitive ∷ (State# (PrimState (MaybeT m)) → (# State# (PrimState (MaybeT m)), a #)) → MaybeT m a Source #

(Monoid w, PrimMonad m) ⇒ PrimMonad (AccumT w m)

Since: primitive-0.6.3.0

Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (AccumT w m) Source #

Methods

primitive ∷ (State# (PrimState (AccumT w m)) → (# State# (PrimState (AccumT w m)), a #)) → AccumT w m a Source #

PrimMonad m ⇒ PrimMonad (ExceptT e m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (ExceptT e m) Source #

Methods

primitive ∷ (State# (PrimState (ExceptT e m)) → (# State# (PrimState (ExceptT e m)), a #)) → ExceptT e m a Source #

PrimMonad m ⇒ PrimMonad (IdentityT m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (IdentityT m) Source #

Methods

primitive ∷ (State# (PrimState (IdentityT m)) → (# State# (PrimState (IdentityT m)), a #)) → IdentityT m a Source #

PrimMonad m ⇒ PrimMonad (ReaderT r m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (ReaderT r m) Source #

Methods

primitive ∷ (State# (PrimState (ReaderT r m)) → (# State# (PrimState (ReaderT r m)), a #)) → ReaderT r m a Source #

PrimMonad m ⇒ PrimMonad (SelectT r m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (SelectT r m) Source #

Methods

primitive ∷ (State# (PrimState (SelectT r m)) → (# State# (PrimState (SelectT r m)), a #)) → SelectT r m a Source #

PrimMonad m ⇒ PrimMonad (StateT s m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (StateT s m) Source #

Methods

primitive ∷ (State# (PrimState (StateT s m)) → (# State# (PrimState (StateT s m)), a #)) → StateT s m a Source #

PrimMonad m ⇒ PrimMonad (StateT s m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (StateT s m) Source #

Methods

primitive ∷ (State# (PrimState (StateT s m)) → (# State# (PrimState (StateT s m)), a #)) → StateT s m a Source #

(Monoid w, PrimMonad m) ⇒ PrimMonad (WriterT w m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (WriterT w m) Source #

Methods

primitive ∷ (State# (PrimState (WriterT w m)) → (# State# (PrimState (WriterT w m)), a #)) → WriterT w m a Source #

(Monoid w, PrimMonad m) ⇒ PrimMonad (WriterT w m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (WriterT w m) Source #

Methods

primitive ∷ (State# (PrimState (WriterT w m)) → (# State# (PrimState (WriterT w m)), a #)) → WriterT w m a Source #

(Monoid w, PrimMonad m) ⇒ PrimMonad (WriterT w m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (WriterT w m) Source #

Methods

primitive ∷ (State# (PrimState (WriterT w m)) → (# State# (PrimState (WriterT w m)), a #)) → WriterT w m a Source #

PrimMonad (CekM uni fun s) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Associated Types

type PrimState (CekM uni fun s) Source #

Methods

primitive ∷ (State# (PrimState (CekM uni fun s)) → (# State# (PrimState (CekM uni fun s)), a #)) → CekM uni fun s a Source #

PrimMonad m ⇒ PrimMonad (ContT r m)

Since: primitive-0.6.3.0

Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (ContT r m) Source #

Methods

primitive ∷ (State# (PrimState (ContT r m)) → (# State# (PrimState (ContT r m)), a #)) → ContT r m a Source #

(Monoid w, PrimMonad m) ⇒ PrimMonad (RWST r w s m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (RWST r w s m) Source #

Methods

primitive ∷ (State# (PrimState (RWST r w s m)) → (# State# (PrimState (RWST r w s m)), a #)) → RWST r w s m a Source #

(Monoid w, PrimMonad m) ⇒ PrimMonad (RWST r w s m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (RWST r w s m) Source #

Methods

primitive ∷ (State# (PrimState (RWST r w s m)) → (# State# (PrimState (RWST r w s m)), a #)) → RWST r w s m a Source #

(Monoid w, PrimMonad m) ⇒ PrimMonad (RWST r w s m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (RWST r w s m) Source #

Methods

primitive ∷ (State# (PrimState (RWST r w s m)) → (# State# (PrimState (RWST r w s m)), a #)) → RWST r w s m a Source #

lenContextContext uni fun ann → Word Source #

cekStateContext ∷ Traversal' (CekState uni fun ann) (Context uni fun ann) Source #

cekStateAnnCekState uni fun ann → Maybe ann Source #

runCekDeBruijnThrowableBuiltins uni fun ⇒ MachineParameters CekMachineCosts fun (CekValue uni fun ann) → ExBudgetMode cost uni fun → EmitterMode uni fun → NTerm uni fun ann → (Either (CekEvaluationException NamedDeBruijn uni fun) (NTerm uni fun ()), cost, [Text]) Source #

computeCek ∷ ∀ uni fun ann s. (ThrowableBuiltins uni fun, GivenCekReqs uni fun ann s) ⇒ Context uni fun ann → CekValEnv uni fun ann → NTerm uni fun ann → CekM uni fun s (CekState uni fun ann) Source #

returnCek ∷ ∀ uni fun ann s. (ThrowableBuiltins uni fun, GivenCekReqs uni fun ann s) ⇒ Context uni fun ann → CekValue uni fun ann → CekM uni fun s (CekState uni fun ann) Source #

mkCekTrans ∷ ∀ cost uni fun ann m s. (ThrowableBuiltins uni fun, PrimMonad m, s ~ PrimState m) ⇒ MachineParameters CekMachineCosts fun (CekValue uni fun ann) → ExBudgetMode cost uni fun → EmitterMode uni fun → Slippage → m (CekTrans uni fun ann s, ExBudgetInfo cost uni fun s) Source #

Based on the supplied arguments, initialize the CEK environment and construct a state transition function. Returns the constructed transition function paired with the methods to live access the running budget.

type CekTrans uni fun ann s = Trans (CekM uni fun s) (CekState uni fun ann) Source #

nilSlippageSlippage Source #

A CEK parameter that turns the slippage optimization *off*.

This is needed in the case of the debugger, where the accounting/budgeting costs must be *live* updated.

data EvaluationResult a Source #

The parameterized type of results various evaluation engines return. On the PLC side this becomes (via makeKnown) either a call to Error or a value of the PLC counterpart of type a.

Instances

Instances details
MonadFail EvaluationResult Source # 
Instance details

Defined in PlutusCore.Evaluation.Result

Foldable EvaluationResult Source # 
Instance details

Defined in PlutusCore.Evaluation.Result

Methods

foldMonoid m ⇒ EvaluationResult m → m Source #

foldMapMonoid m ⇒ (a → m) → EvaluationResult a → m Source #

foldMap'Monoid m ⇒ (a → m) → EvaluationResult a → m Source #

foldr ∷ (a → b → b) → b → EvaluationResult a → b Source #

foldr' ∷ (a → b → b) → b → EvaluationResult a → b Source #

foldl ∷ (b → a → b) → b → EvaluationResult a → b Source #

foldl' ∷ (b → a → b) → b → EvaluationResult a → b Source #

foldr1 ∷ (a → a → a) → EvaluationResult a → a Source #

foldl1 ∷ (a → a → a) → EvaluationResult a → a Source #

toListEvaluationResult a → [a] Source #

nullEvaluationResult a → Bool Source #

lengthEvaluationResult a → Int Source #

elemEq a ⇒ a → EvaluationResult a → Bool Source #

maximumOrd a ⇒ EvaluationResult a → a Source #

minimumOrd a ⇒ EvaluationResult a → a Source #

sumNum a ⇒ EvaluationResult a → a Source #

productNum a ⇒ EvaluationResult a → a Source #

Traversable EvaluationResult Source # 
Instance details

Defined in PlutusCore.Evaluation.Result

Methods

traverseApplicative f ⇒ (a → f b) → EvaluationResult a → f (EvaluationResult b) Source #

sequenceAApplicative f ⇒ EvaluationResult (f a) → f (EvaluationResult a) Source #

mapMMonad m ⇒ (a → m b) → EvaluationResult a → m (EvaluationResult b) Source #

sequenceMonad m ⇒ EvaluationResult (m a) → m (EvaluationResult a) Source #

Alternative EvaluationResult Source # 
Instance details

Defined in PlutusCore.Evaluation.Result

Applicative EvaluationResult Source # 
Instance details

Defined in PlutusCore.Evaluation.Result

Functor EvaluationResult Source # 
Instance details

Defined in PlutusCore.Evaluation.Result

Methods

fmap ∷ (a → b) → EvaluationResult a → EvaluationResult b Source #

(<$) ∷ a → EvaluationResult b → EvaluationResult a Source #

Monad EvaluationResult Source # 
Instance details

Defined in PlutusCore.Evaluation.Result

MonadError () EvaluationResult Source # 
Instance details

Defined in PlutusCore.Evaluation.Result

KnownTypeAst tyname uni a ⇒ KnownTypeAst tyname uni (EvaluationResult a ∷ Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

Associated Types

type IsBuiltin uni (EvaluationResult a) ∷ Bool Source #

type ToHoles uni (EvaluationResult a) ∷ [Hole] Source #

type ToBinds uni acc (EvaluationResult a) ∷ [Some TyNameRep] Source #

Methods

typeAstType0 tyname uni () Source #

(TypeError ('Text "Use \8216BuiltinResult\8217 instead of \8216EvaluationResult\8217") ∷ Constraint, uni ~ UniOf val) ⇒ MakeKnownIn uni val (EvaluationResult a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownType

(TypeError ('Text "Use \8216BuiltinResult\8217 instead of \8216EvaluationResult\8217") ∷ Constraint, uni ~ UniOf val) ⇒ ReadKnownIn uni val (EvaluationResult a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownType

PrettyBy config a ⇒ PrettyBy config (EvaluationResult a) Source # 
Instance details

Defined in PlutusCore.Evaluation.Result

Methods

prettyBy ∷ config → EvaluationResult a → Doc ann Source #

prettyListBy ∷ config → [EvaluationResult a] → Doc ann Source #

Generic (EvaluationResult a) Source # 
Instance details

Defined in PlutusCore.Evaluation.Result

Associated Types

type Rep (EvaluationResult a) ∷ TypeType Source #

Show a ⇒ Show (EvaluationResult a) Source # 
Instance details

Defined in PlutusCore.Evaluation.Result

NFData a ⇒ NFData (EvaluationResult a) Source # 
Instance details

Defined in PlutusCore.Evaluation.Result

Methods

rnfEvaluationResult a → () Source #

Eq a ⇒ Eq (EvaluationResult a) Source # 
Instance details

Defined in PlutusCore.Evaluation.Result

AsEvaluationFailure (EvaluationResult a) Source # 
Instance details

Defined in PlutusCore.Evaluation.Result

Methods

_EvaluationFailure ∷ Prism' (EvaluationResult a) () Source #

PrettyClassic a ⇒ Pretty (EvaluationResult a) Source # 
Instance details

Defined in PlutusCore.Evaluation.Result

type ToBinds uni acc (EvaluationResult a ∷ Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds uni acc (EvaluationResult a ∷ Type) = ToBinds uni acc a
type IsBuiltin uni (EvaluationResult a ∷ Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (EvaluationResult a ∷ Type) = 'False
type ToHoles uni (EvaluationResult a ∷ Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles uni (EvaluationResult a ∷ Type) = '[TypeHole a ∷ Hole]
type Rep (EvaluationResult a) Source # 
Instance details

Defined in PlutusCore.Evaluation.Result

type Rep (EvaluationResult a) = D1 ('MetaData "EvaluationResult" "PlutusCore.Evaluation.Result" "plutus-core-1.34.1.0-inplace" 'False) (C1 ('MetaCons "EvaluationSuccess" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a)) :+: C1 ('MetaCons "EvaluationFailure" 'PrefixI 'False) (U1TypeType))

data EvaluationError structural operational Source #

The type of errors that can occur during evaluation. There are two kinds of errors:

  1. 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.
  2. 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.

Constructors

StructuralEvaluationError !structural 
OperationalEvaluationError !operational 

Instances

Instances details
Bifoldable EvaluationError Source # 
Instance details

Defined in PlutusCore.Evaluation.Error

Methods

bifoldMonoid m ⇒ EvaluationError m m → m Source #

bifoldMapMonoid 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 # 
Instance details

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

Defined in PlutusCore.Evaluation.Error

Methods

bitraverseApplicative 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 # 
Instance details

Defined in PlutusCore.Evaluation.Error

Methods

prettyBy ∷ config → EvaluationError structural operational → Doc ann Source #

prettyListBy ∷ config → [EvaluationError structural operational] → Doc ann Source #

Functor (EvaluationError structural) Source # 
Instance details

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

Defined in PlutusCore.Evaluation.Error

Associated Types

type Rep (EvaluationError structural operational) ∷ TypeType Source #

Methods

fromEvaluationError structural operational → Rep (EvaluationError structural operational) x Source #

toRep (EvaluationError structural operational) x → EvaluationError structural operational Source #

(Show structural, Show operational) ⇒ Show (EvaluationError structural operational) Source # 
Instance details

Defined in PlutusCore.Evaluation.Error

Methods

showsPrecIntEvaluationError structural operational → ShowS Source #

showEvaluationError structural operational → String Source #

showList ∷ [EvaluationError structural operational] → ShowS Source #

(NFData structural, NFData operational) ⇒ NFData (EvaluationError structural operational) Source # 
Instance details

Defined in PlutusCore.Evaluation.Error

Methods

rnfEvaluationError structural operational → () Source #

(Eq structural, Eq operational) ⇒ Eq (EvaluationError structural operational) Source # 
Instance details

Defined in PlutusCore.Evaluation.Error

Methods

(==)EvaluationError structural operational → EvaluationError structural operational → Bool Source #

(/=)EvaluationError structural operational → EvaluationError structural operational → Bool Source #

(AsUnliftingError structural, AsUnliftingError operational) ⇒ AsUnliftingEvaluationError (EvaluationError structural operational) Source #

An UnliftingEvaluationError is an EvaluationError, hence for this instance we only require both operational and structural to have _UnliftingError prisms, so that we can handle both the cases pointwisely.

Instance details

Defined in PlutusCore.Builtin.Result

AsEvaluationFailure operational ⇒ AsEvaluationFailure (EvaluationError structural operational) Source #

A raw evaluation failure is always an operational error.

Instance details

Defined in PlutusCore.Evaluation.Error

Methods

_EvaluationFailure ∷ Prism' (EvaluationError structural operational) () Source #

(Pretty structural, Pretty operational) ⇒ Pretty (EvaluationError structural operational) Source # 
Instance details

Defined in PlutusCore.Evaluation.Error

Methods

prettyEvaluationError structural operational → Doc ann Source #

prettyList ∷ [EvaluationError structural operational] → Doc ann Source #

structural ~ MachineError fun ⇒ AsMachineError (EvaluationError structural operational) fun Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.Exception

Methods

_MachineError ∷ Prism' (EvaluationError structural operational) (MachineError fun) Source #

_NonPolymorphicInstantiationMachineError ∷ Prism' (EvaluationError structural operational) () Source #

_NonWrapUnwrappedMachineError ∷ Prism' (EvaluationError structural operational) () Source #

_NonFunctionalApplicationMachineError ∷ Prism' (EvaluationError structural operational) () Source #

_OpenTermEvaluatedMachineError ∷ Prism' (EvaluationError structural operational) () Source #

_UnliftingMachineError ∷ Prism' (EvaluationError structural operational) UnliftingError Source #

_BuiltinTermArgumentExpectedMachineError ∷ Prism' (EvaluationError structural operational) () Source #

_UnexpectedBuiltinTermArgumentMachineError ∷ Prism' (EvaluationError structural operational) () Source #

_NonConstrScrutinized ∷ Prism' (EvaluationError structural operational) () Source #

_MissingCaseBranch ∷ Prism' (EvaluationError structural operational) Word64 Source #

AsEvaluationError (EvaluationError structural operational) structural operational Source # 
Instance details

Defined in PlutusCore.Evaluation.Error

Methods

_EvaluationError ∷ Prism' (EvaluationError structural operational) (EvaluationError structural operational) Source #

_StructuralEvaluationError ∷ Prism' (EvaluationError structural operational) structural Source #

_OperationalEvaluationError ∷ Prism' (EvaluationError structural operational) operational Source #

ThrowableBuiltins uni fun ⇒ MonadError (CekEvaluationException NamedDeBruijn uni fun) (CekM uni fun s) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

throwErrorCekEvaluationException NamedDeBruijn uni fun → CekM uni fun s a Source #

catchErrorCekM 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 # 
Instance details

Defined in PlutusCore.Evaluation.Error

type Rep (EvaluationError structural operational) = D1 ('MetaData "EvaluationError" "PlutusCore.Evaluation.Error" "plutus-core-1.34.1.0-inplace" 'False) (C1 ('MetaCons "StructuralEvaluationError" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 structural)) :+: C1 ('MetaCons "OperationalEvaluationError" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 operational)))

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

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

Methods

prettyBy ∷ config → ErrorWithCause err cause → Doc ann Source #

prettyListBy ∷ config → [ErrorWithCause err cause] → Doc ann Source #

Foldable (ErrorWithCause err) Source # 
Instance details

Defined in PlutusCore.Evaluation.ErrorWithCause

Methods

foldMonoid m ⇒ ErrorWithCause err m → m Source #

foldMapMonoid 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 #

toListErrorWithCause err a → [a] Source #

nullErrorWithCause err a → Bool Source #

lengthErrorWithCause err a → Int Source #

elemEq a ⇒ a → ErrorWithCause err a → Bool Source #

maximumOrd a ⇒ ErrorWithCause err a → a Source #

minimumOrd a ⇒ ErrorWithCause err a → a Source #

sumNum a ⇒ ErrorWithCause err a → a Source #

productNum a ⇒ ErrorWithCause err a → a Source #

Traversable (ErrorWithCause err) Source # 
Instance details

Defined in PlutusCore.Evaluation.ErrorWithCause

Methods

traverseApplicative f ⇒ (a → f b) → ErrorWithCause err a → f (ErrorWithCause err b) Source #

sequenceAApplicative f ⇒ ErrorWithCause err (f a) → f (ErrorWithCause err a) Source #

mapMMonad m ⇒ (a → m b) → ErrorWithCause err a → m (ErrorWithCause err b) Source #

sequenceMonad m ⇒ ErrorWithCause err (m a) → m (ErrorWithCause err a) Source #

Functor (ErrorWithCause err) Source # 
Instance details

Defined in PlutusCore.Evaluation.ErrorWithCause

Methods

fmap ∷ (a → b) → ErrorWithCause err a → ErrorWithCause err b Source #

(<$) ∷ a → ErrorWithCause err b → ErrorWithCause err a Source #

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

Defined in PlutusCore.Evaluation.ErrorWithCause

Generic (ErrorWithCause err cause) Source # 
Instance details

Defined in PlutusCore.Evaluation.ErrorWithCause

Associated Types

type Rep (ErrorWithCause err cause) ∷ TypeType Source #

Methods

fromErrorWithCause err cause → Rep (ErrorWithCause err cause) x Source #

toRep (ErrorWithCause err cause) x → ErrorWithCause err cause Source #

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

Defined in PlutusCore.Evaluation.ErrorWithCause

Methods

showsPrecIntErrorWithCause err cause → ShowS Source #

showErrorWithCause err cause → String Source #

showList ∷ [ErrorWithCause err cause] → ShowS Source #

(NFData err, NFData cause) ⇒ NFData (ErrorWithCause err cause) Source # 
Instance details

Defined in PlutusCore.Evaluation.ErrorWithCause

Methods

rnfErrorWithCause err cause → () Source #

(Eq err, Eq cause) ⇒ Eq (ErrorWithCause err cause) Source # 
Instance details

Defined in PlutusCore.Evaluation.ErrorWithCause

Methods

(==)ErrorWithCause err cause → ErrorWithCause err cause → Bool Source #

(/=)ErrorWithCause err cause → ErrorWithCause err cause → Bool Source #

AsEvaluationFailure err ⇒ AsEvaluationFailure (ErrorWithCause err cause) Source # 
Instance details

Defined in PlutusCore.Evaluation.ErrorWithCause

Methods

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

(Pretty err, Pretty cause) ⇒ Pretty (ErrorWithCause err cause) Source # 
Instance details

Defined in PlutusCore.Evaluation.ErrorWithCause

Methods

prettyErrorWithCause err cause → Doc ann Source #

prettyList ∷ [ErrorWithCause err cause] → Doc ann Source #

ThrowableBuiltins uni fun ⇒ MonadError (CekEvaluationException NamedDeBruijn uni fun) (CekM uni fun s) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

throwErrorCekEvaluationException NamedDeBruijn uni fun → CekM uni fun s a Source #

catchErrorCekM uni fun s a → (CekEvaluationException NamedDeBruijn uni fun → CekM uni fun s a) → CekM uni fun s a Source #

type Rep (ErrorWithCause err cause) Source # 
Instance details

Defined in PlutusCore.Evaluation.ErrorWithCause

type Rep (ErrorWithCause err cause) = D1 ('MetaData "ErrorWithCause" "PlutusCore.Evaluation.ErrorWithCause" "plutus-core-1.34.1.0-inplace" 'False) (C1 ('MetaCons "ErrorWithCause" 'PrefixI 'True) (S1 ('MetaSel ('Just "_ewcError") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 err) :*: S1 ('MetaSel ('Just "_ewcCause") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe cause))))

type ThrowableBuiltins uni fun = (PrettyUni uni, Pretty fun, Typeable uni, Typeable fun) Source #

The set of constraints we need to be able to throw exceptions with things with built-in types and functions in them.

data CekUserError Source #

Constructors

CekOutOfExError !ExRestrictingBudget

The final overspent (i.e. negative) budget.

CekEvaluationFailure

Error has been called or a builtin application has failed

Instances

Instances details
Generic CekUserError Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Associated Types

type Rep CekUserErrorTypeType Source #

Show CekUserError Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

NFData CekUserError Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

rnfCekUserError → () Source #

Eq CekUserError Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

AsUnliftingError CekUserError Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

AsEvaluationFailure CekUserError Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Pretty CekUserError Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

prettyCekUserErrorDoc ann Source #

prettyList ∷ [CekUserError] → Doc ann Source #

ThrowableBuiltins uni fun ⇒ MonadError (CekEvaluationException NamedDeBruijn uni fun) (CekM uni fun s) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

throwErrorCekEvaluationException NamedDeBruijn uni fun → CekM uni fun s a Source #

catchErrorCekM uni fun s a → (CekEvaluationException NamedDeBruijn uni fun → CekM uni fun s a) → CekM uni fun s a Source #

type Rep CekUserError Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

type Rep CekUserError = D1 ('MetaData "CekUserError" "UntypedPlutusCore.Evaluation.Machine.Cek.Internal" "plutus-core-1.34.1.0-inplace" 'False) (C1 ('MetaCons "CekOutOfExError" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ExRestrictingBudget)) :+: C1 ('MetaCons "CekEvaluationFailure" 'PrefixI 'False) (U1TypeType))

type CekEvaluationException name uni fun = EvaluationException (MachineError fun) CekUserError (Term name uni fun ()) Source #

The CEK machine-specific EvaluationException.

data ExBudgetCategory fun Source #

Constructors

BStep StepKind 
BBuiltinApp fun 
BStartup 

Instances

Instances details
ExBudgetBuiltin fun (ExBudgetCategory fun) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

exBudgetBuiltin ∷ fun → ExBudgetCategory fun Source #

Generic (ExBudgetCategory fun) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Associated Types

type Rep (ExBudgetCategory fun) ∷ TypeType Source #

Show fun ⇒ Show (ExBudgetCategory fun) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

NFData fun ⇒ NFData (ExBudgetCategory fun) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

rnfExBudgetCategory fun → () Source #

Eq fun ⇒ Eq (ExBudgetCategory fun) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Ord fun ⇒ Ord (ExBudgetCategory fun) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Hashable fun ⇒ Hashable (ExBudgetCategory fun) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Show fun ⇒ Pretty (ExBudgetCategory fun) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

prettyExBudgetCategory fun → Doc ann Source #

prettyList ∷ [ExBudgetCategory fun] → Doc ann Source #

type Rep (ExBudgetCategory fun) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

type Rep (ExBudgetCategory fun) = D1 ('MetaData "ExBudgetCategory" "UntypedPlutusCore.Evaluation.Machine.Cek.Internal" "plutus-core-1.34.1.0-inplace" 'False) (C1 ('MetaCons "BStep" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 StepKind)) :+: (C1 ('MetaCons "BBuiltinApp" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 fun)) :+: C1 ('MetaCons "BStartup" 'PrefixI 'False) (U1TypeType)))

newtype CekBudgetSpender uni fun s Source #

The CEK machine is parameterized over a spendBudget function. This makes the budgeting machinery extensible and allows us to separate budgeting logic from evaluation logic and avoid branching on the union of all possible budgeting state types during evaluation.

Constructors

CekBudgetSpender 

Fields

newtype ExBudgetMode cost uni fun Source #

A budgeting mode to execute the CEK machine in.

Constructors

ExBudgetMode 

Fields

data StepKind Source #

Instances

Instances details
Bounded StepKind Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Enum StepKind Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Generic StepKind Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Associated Types

type Rep StepKindTypeType Source #

Show StepKind Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

NFData StepKind Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

rnfStepKind → () Source #

Eq StepKind Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Ord StepKind Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Hashable StepKind Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

type Rep StepKind Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

type Rep StepKind = D1 ('MetaData "StepKind" "UntypedPlutusCore.Evaluation.Machine.Cek.Internal" "plutus-core-1.34.1.0-inplace" 'False) (((C1 ('MetaCons "BConst" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "BVar" 'PrefixI 'False) (U1TypeType)) :+: (C1 ('MetaCons "BLamAbs" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "BApply" 'PrefixI 'False) (U1TypeType))) :+: ((C1 ('MetaCons "BDelay" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "BForce" 'PrefixI 'False) (U1TypeType)) :+: (C1 ('MetaCons "BBuiltin" 'PrefixI 'False) (U1TypeType) :+: (C1 ('MetaCons "BConstr" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "BCase" 'PrefixI 'False) (U1TypeType)))))

data CekValue uni fun ann Source #

Constructors

VCon !(Some (ValueOf uni)) 
VDelay !(NTerm uni fun ann) !(CekValEnv uni fun ann) 
VLamAbs !NamedDeBruijn !(NTerm uni fun ann) !(CekValEnv uni fun ann) 
VBuiltin

A partial builtin application, accumulating arguments for eventual full application. We don't need a CekValEnv here unlike in the other constructors, because VBuiltin values always store their corresponding Terms fully discharged, see the comments at the call sites (search for VBuiltin).

Fields

  • !fun

    So that we know, for what builtin we're calculating the cost. We can sneak this into BuiltinRuntime, so that we don't need to store it here, but somehow doing so was consistently slowing evaluation down by half a percent. Might be noise, might be not, but at least we know that removing this fun is not helpful anyway. See this commit reversing the change: https://github.com/IntersectMBO/plutus/pull/4778/commits/86a3e24ca3c671cc27c6f4344da2bcd14f961706

  • (NTerm uni fun ())

    This must be lazy. It represents the fully discharged partial application of the builtin function that we're going to run when it's fully saturated. We need the Term to be able to return it in case full saturation is never achieved and a partial application needs to be returned in the result. The laziness is important, because the arguments are discharged values and discharging is expensive, so we don't want to do it unless we really have to. Making this field strict resulted in a 3-4.5% slowdown at the time of writing.

  • !(BuiltinRuntime (CekValue uni fun ann))

    The partial application and its costing function. Check the docs of BuiltinRuntime for details. | A constructor value, including fully computed arguments and the tag.

VConstr !Word64 !(ArgStack uni fun ann) 

Instances

Instances details
(PrettyUni uni, Pretty fun) ⇒ PrettyBy PrettyConfigPlc (CekValue uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

prettyByPrettyConfigPlcCekValue uni fun ann → Doc ann0 Source #

prettyListByPrettyConfigPlc → [CekValue uni fun ann] → Doc ann0 Source #

Show (BuiltinRuntime (CekValue uni fun ann)) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

showsPrecIntBuiltinRuntime (CekValue uni fun ann) → ShowS Source #

showBuiltinRuntime (CekValue uni fun ann) → String Source #

showList ∷ [BuiltinRuntime (CekValue uni fun ann)] → ShowS Source #

(GShow uni, Everywhere uni Show, Show fun, Show ann, Closed uni) ⇒ Show (CekValue uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

showsPrecIntCekValue uni fun ann → ShowS Source #

showCekValue uni fun ann → String Source #

showList ∷ [CekValue uni fun ann] → ShowS Source #

HasConstant (CekValue uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

asConstantCekValue uni fun ann → Either BuiltinError (Some (ValueOf (UniOf (CekValue uni fun ann)))) Source #

fromConstantSome (ValueOf (UniOf (CekValue uni fun ann))) → CekValue uni fun ann Source #

(Closed uni, Everywhere uni ExMemoryUsage) ⇒ ExMemoryUsage (CekValue uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

memoryUsageCekValue uni fun ann → CostRose Source #

type UniOf (CekValue uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

type UniOf (CekValue uni fun ann) = uni

newtype EmitterMode uni fun Source #

An emitting mode to execute the CEK machine in, similar to ExBudgetMode.

Constructors

EmitterMode 

Fields

data ArgStack uni fun ann Source #

A LIFO stack of CekValues, useful for recording multiple arguments which will need to be pushed onto the context in reverse order.

Constructors

EmptyStack 
ConsStack !(CekValue uni fun ann) !(ArgStack uni fun ann) 

Instances

Instances details
(GShow uni, Everywhere uni Show, Show fun, Show ann, Closed uni) ⇒ Show (ArgStack uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

showsPrecIntArgStack uni fun ann → ShowS Source #

showArgStack uni fun ann → String Source #

showList ∷ [ArgStack uni fun ann] → ShowS Source #

data ExBudgetInfo cost uni fun s Source #

Runtime budgeting info.

Constructors

ExBudgetInfo 

Fields

type CekEmitter uni fun s = DList TextCekM uni fun s () Source #

The CEK machine is parameterized over an emitter function, similar to CekBudgetSpender.

data CekEmitterInfo uni fun s Source #

Runtime emitter info, similar to ExBudgetInfo.

Constructors

CekEmitterInfo 

Fields

newtype CekM uni fun s a Source #

The monad the CEK machine runs in.

Constructors

CekM 

Fields

Instances

Instances details
Applicative (CekM uni fun s) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

pure ∷ a → CekM uni fun s a Source #

(<*>)CekM uni fun s (a → b) → CekM uni fun s a → CekM uni fun s b Source #

liftA2 ∷ (a → b → c) → CekM uni fun s a → CekM uni fun s b → CekM uni fun s c Source #

(*>)CekM uni fun s a → CekM uni fun s b → CekM uni fun s b Source #

(<*)CekM uni fun s a → CekM uni fun s b → CekM uni fun s a Source #

Functor (CekM uni fun s) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

fmap ∷ (a → b) → CekM uni fun s a → CekM uni fun s b Source #

(<$) ∷ a → CekM uni fun s b → CekM uni fun s a Source #

Monad (CekM uni fun s) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

(>>=)CekM uni fun s a → (a → CekM uni fun s b) → CekM uni fun s b Source #

(>>)CekM uni fun s a → CekM uni fun s b → CekM uni fun s b Source #

return ∷ a → CekM uni fun s a Source #

PrimMonad (CekM uni fun s) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Associated Types

type PrimState (CekM uni fun s) Source #

Methods

primitive ∷ (State# (PrimState (CekM uni fun s)) → (# State# (PrimState (CekM uni fun s)), a #)) → CekM uni fun s a Source #

ThrowableBuiltins uni fun ⇒ MonadError (CekEvaluationException NamedDeBruijn uni fun) (CekM uni fun s) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

throwErrorCekEvaluationException NamedDeBruijn uni fun → CekM uni fun s a Source #

catchErrorCekM uni fun s a → (CekEvaluationException NamedDeBruijn uni fun → CekM uni fun s a) → CekM uni fun s a Source #

type PrimState (CekM uni fun s) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

type PrimState (CekM uni fun s) = PrimState (ST s)

type CekValEnv uni fun ann = RAList (CekValue uni fun ann) Source #

type GivenCekReqs uni fun ann s = (GivenCekRuntime uni fun ann, GivenCekEmitter uni fun s, GivenCekSpender uni fun s, GivenCekSlippage, GivenCekStepCounter s, GivenCekCosts) Source #

Constraint requiring all of the machine's implicit parameters.

type GivenCekSpender uni fun s = ?cekBudgetSpender ∷ CekBudgetSpender uni fun s Source #

Implicit parameter for budget spender.

data StepCounter (n ∷ Nat) s Source #

A set of Word8 counters that is used in the CEK machine to count steps.

type CounterSize = NumberOfStepCounters + 1 Source #

The total number of counters that we need, one extra for the total counter. See Note [Structure of the step counter]

type TotalCountIndex = NumberOfStepCounters Source #

The index at which the total step counter is kept. See Note [Structure of the step counter]

type NTerm uni fun = Term NamedDeBruijn uni fun Source #

The Terms that CEK can execute must have DeBruijn binders Name is not necessary but we leave it here for simplicity and debuggability.

extractEvaluationResultEither (EvaluationException structural operational term) a → Either (ErrorWithCause structural term) (EvaluationResult a) Source #

Preserve the contents of an StructuralEvaluationError as a Left and turn an OperationalEvaluationError into a Right EvaluationFailure.

unsafeToEvaluationResult ∷ (PrettyPlc structural, PrettyPlc term, Typeable structural, Typeable term) ⇒ Either (EvaluationException structural operational term) a → EvaluationResult a Source #

dischargeCekValueCekValue uni fun ann → NTerm uni fun () Source #

Convert a CekValue into a Term by replacing all bound variables with the terms they're bound to (which themselves have to be obtain by recursively discharging values).

defaultSlippageSlippage Source #

The default number of slippage (in machine steps) to allow.

runCekM ∷ ∀ a cost uni fun ann. ThrowableBuiltins uni fun ⇒ MachineParameters CekMachineCosts fun (CekValue uni fun ann) → ExBudgetMode cost uni fun → EmitterMode uni fun → (∀ s. GivenCekReqs uni fun ann s ⇒ CekM uni fun s a) → (Either (CekEvaluationException NamedDeBruijn uni fun) a, cost, [Text]) Source #