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

PlutusIR.Compiler.Datatype

Description

Functions for compiling let-bound PIR datatypes into PLC.

Synopsis

Documentation

compileDatatypeCompiling m e uni fun a ⇒ RecursivityPIRTerm uni fun a → Datatype TyName Name uni (Provenance a) → m (PIRTerm uni fun a) Source #

Compile a Datatype bound with the given body.

compileDatatypeDefsMonadQuote m ⇒ DatatypeCompilationOptsRecursivityDatatype TyName Name uni (Provenance a) → m (Def (TyVarDecl TyName (Provenance a)) (PLCRecType uni fun a), [Def (VarDecl TyName Name uni (Provenance a)) (PIRTerm uni fun a)], Def (VarDecl TyName Name uni (Provenance a)) (PIRTerm uni fun a)) Source #

Compile a Datatype to a triple of type-constructor, data-constructors, destructor definitions.

compileRecDatatypesCompiling m e uni fun a ⇒ PIRTerm uni fun a → NonEmpty (Datatype TyName Name uni (Provenance a)) → m (PIRTerm uni fun a) Source #

mkDatatypeValueType ∷ a → Datatype TyName Name uni a → Type TyName uni a Source #

The type of a datatype-value is of the form `[TyCon tyarg1 tyarg2 ... tyargn]`

mkDestructorTyMonadQuote m ⇒ Datatype TyName Name uni a → m (Type TyName uni a) Source #

Make the type of a destructor for a Datatype. mkDestructorTy List = forall (a :: *) . List a -> forall (out_List :: *) . (out_List -> (a -> List a -> out_List) -> out_List)

mkScottTyMonadQuote m ⇒ ann → Datatype TyName Name uni ann → m (Type TyName uni ann) Source #

Make the "Scott-encoded" type for a Datatype, with type variables free. This is exactly the type of an eliminator function for the datatype.

mkScottTy Maybe = forall out_Maybe. out_Maybe -> (a -> out_Maybe) -> out_Maybe