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

UntypedPlutusCore.Purity

Synopsis

Documentation

isPureToBuiltinMeaning uni fun ⇒ BuiltinSemanticsVariant fun → Term name uni fun a → Bool Source #

Will evaluating this term have side effects (looping or error)? This is slightly wider than the definition of a value, as it includes applications that are known to be pure, as well as things that can't be returned from the machine (as they'd be ill-scoped).

isWorkFreeToBuiltinMeaning uni fun ⇒ BuiltinSemanticsVariant fun → Term name uni fun a → Bool Source #

Is the given term 'work-free'?

Note: The definition of 'work-free' is a little unclear, but the idea is that evaluating this term should do very a trivial amount of work.

data EvalOrder name uni fun a Source #

The order in which terms get evaluated, along with their purities.

Instances

Instances details
PrettyBy config (Term name uni fun a) ⇒ PrettyBy config (EvalOrder name uni fun a) Source # 
Instance details

Defined in UntypedPlutusCore.Purity

Methods

prettyBy ∷ config → EvalOrder name uni fun a → Doc ann Source #

prettyListBy ∷ config → [EvalOrder name uni fun a] → Doc ann Source #

Monoid (EvalOrder name uni fun a) Source # 
Instance details

Defined in UntypedPlutusCore.Purity

Methods

memptyEvalOrder name uni fun a Source #

mappendEvalOrder name uni fun a → EvalOrder name uni fun a → EvalOrder name uni fun a Source #

mconcat ∷ [EvalOrder name uni fun a] → EvalOrder name uni fun a Source #

Semigroup (EvalOrder name uni fun a) Source # 
Instance details

Defined in UntypedPlutusCore.Purity

Methods

(<>)EvalOrder name uni fun a → EvalOrder name uni fun a → EvalOrder name uni fun a Source #

sconcatNonEmpty (EvalOrder name uni fun a) → EvalOrder name uni fun a Source #

stimesIntegral b ⇒ b → EvalOrder name uni fun a → EvalOrder name uni fun a Source #

unEvalOrderEvalOrder name uni fun a → [EvalTerm name uni fun a] Source #

Get the evaluation order as a list of EvalTerms. Either terminates in a single Unknown, which means that we got to a point where evaluation continues but we don't know where; or terminates normally, in which case we actually got to the end of the evaluation order for the term.

data EvalTerm name uni fun a Source #

Either the "next" term to be evaluated, along with its Purity and WorkFreedom, or we don't know what comes next.

Constructors

Unknown 
EvalTerm Purity WorkFreedom (Term name uni fun a) 

Instances

Instances details
PrettyBy config (Term name uni fun a) ⇒ PrettyBy config (EvalTerm name uni fun a) Source # 
Instance details

Defined in UntypedPlutusCore.Purity

Methods

prettyBy ∷ config → EvalTerm name uni fun a → Doc ann Source #

prettyListBy ∷ config → [EvalTerm name uni fun a] → Doc ann Source #

data Purity Source #

Is this pure? Either yes, or maybe not.

Constructors

MaybeImpure 
Pure 

Instances

Instances details
Pretty Purity Source # 
Instance details

Defined in UntypedPlutusCore.Purity

Methods

prettyPurityDoc ann #

prettyList ∷ [Purity] → Doc ann #

termEvaluationOrder ∷ ∀ name uni fun a. ToBuiltinMeaning uni fun ⇒ BuiltinSemanticsVariant fun → Term name uni fun a → EvalOrder name uni fun a Source #

Given a term, return the order in which it and its sub-terms will be evaluated.

This aims to be a sound under-approximation: if we don't know, we just say Unknown. Typically there will be a sequence of terms that we do know, which will terminate in Unknown once we do something like call a function.

This makes some assumptions about the evaluator, in particular about the order in which we evaluate sub-terms, but these match the current evaluator and we are not planning on changing it.