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

PlutusIR.Compiler

Synopsis

Documentation

compileProgram :: Compiling m uni fun a => Program TyName Name uni fun a -> m (PLCProgram uni fun a) #

compileToReadable :: forall m uni fun a b. (Compiling m uni fun a, b ~ Provenance a) => Program TyName Name uni fun b -> m (Program TyName Name uni fun b) #

The 1st half of the PIR compiler pipeline up to floating/merging the lets. We stop momentarily here to give a chance to the tx-plugin to dump a "readable" version of pir (i.e. floated).

compileReadableToPlc :: forall m uni fun a b. (Compiling m uni fun a, b ~ Provenance a) => Program TyName Name uni fun b -> m (PLCProgram uni fun a) #

The 2nd half of the PIR compiler pipeline. Compiles a Term into a PLC Term, by removing/translating step-by-step the PIR's language constructs to PLC. Note: the result *does* have globally unique names.

type Compiling m uni fun a = (Doc ann0 #

data Provenance a #

Indicates where a value comes from.

This is either an original annotation or a pieces of context explaining how the term relates to a previous Provenance. We also provide noProvenance for convenience.

The provenance should always be just the original annotation, if we have one. It should only be another kind of provenance if we're in the process of generating some term that doesn't correspond directly to a term in the original AST.

Constructors

Original a 
LetBinding Recursivity (Provenance a) 
TermBinding Lens' (CompilationOpts a) DatatypeCompilationOpts #

data DatatypeStyle #

What style to use when encoding datatypes. Generally, SumsOfProducts is superior, unless you are targeting an old Plutus Core language version.

See Note [Encoding of datatypes]

Constructors

ScottEncoding 
SumsOfProducts 
BuiltinCasing

A temporary data type style used to make a couple of V3 ledger-api-test tests pass before we can support casing on values of built-in types in newer protocol versions and merge this into SumsOfProducts (which is what controls whether Case is available or not).

Instances

Instances details
Lens' (PirTCConfig uni fun) (BuiltinTypes uni fun) #

data AllowEscape #

Extra flag to be passed in the TypeCheckM Reader context, to signal if the PIR expression currently being typechecked is at the top-level and thus its type can escape, or nested and thus not allowed to escape.

Constructors

YesEscape 
NoEscape 

runCompilerPass :: (Compiling m uni fun a, b ~ Provenance a) => m (Pass m tyname name uni fun b) -> Term tyname name uni fun b -> m (Term tyname name uni fun b) #

simplifier :: Compiling m uni fun a => m (Pass m TyName Name uni fun (Provenance a)) #