Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Kind ann
- toPatFuncKind ∷ Kind () → Kind ()
- fromPatFuncKind ∷ Kind () → Maybe (Kind ())
- argsFunKind ∷ Kind ann → [Kind ann]
- data Type tyname uni ann
- = TyVar ann tyname
- | TyFun ann (Type tyname uni ann) (Type tyname uni ann)
- | TyIFix ann (Type tyname uni ann) (Type tyname uni ann)
- | TyForall ann tyname (Kind ann) (Type tyname uni ann)
- | TyBuiltin ann (SomeTypeIn uni)
- | TyLam ann tyname (Kind ann) (Type tyname uni ann)
- | TyApp ann (Type tyname uni ann) (Type tyname uni ann)
- | TySOP ann [[Type tyname uni ann]]
- splitFunTyParts ∷ Type tyname uni a → NonEmpty (Type tyname uni a)
- funTyArgs ∷ Type tyname uni a → [Type tyname uni a]
- funTyResultType ∷ Type tyname uni a → Type tyname uni a
- data Term tyname name uni fun ann
- = Var ann name
- | LamAbs ann name (Type tyname uni ann) (Term tyname name uni fun ann)
- | Apply ann (Term tyname name uni fun ann) (Term tyname name uni fun ann)
- | TyAbs ann tyname (Kind ann) (Term tyname name uni fun ann)
- | TyInst ann (Term tyname name uni fun ann) (Type tyname uni ann)
- | IWrap ann (Type tyname uni ann) (Type tyname uni ann) (Term tyname name uni fun ann)
- | Unwrap ann (Term tyname name uni fun ann)
- | Constr ann (Type tyname uni ann) Word64 [Term tyname name uni fun ann]
- | Case ann (Type tyname uni ann) (Term tyname name uni fun ann) [Term tyname name uni fun ann]
- | Constant ann (Some (ValueOf uni))
- | Builtin ann fun
- | Error ann (Type tyname uni ann)
- data Program tyname name uni fun ann = Program {}
- type HasTermLevel uni = Includes uni
- type family UniOf a ∷ Type → Type
- newtype Normalized a = Normalized {
- unNormalized ∷ a
- data TyVarDecl tyname ann = TyVarDecl {
- _tyVarDeclAnn ∷ ann
- _tyVarDeclName ∷ tyname
- _tyVarDeclKind ∷ Kind ann
- data VarDecl tyname name uni ann = VarDecl {
- _varDeclAnn ∷ ann
- _varDeclName ∷ name
- _varDeclType ∷ Type tyname uni ann
- data TyDecl tyname uni ann = TyDecl {
- _tyDeclAnn ∷ ann
- _tyDeclType ∷ Type tyname uni ann
- _tyDeclKind ∷ Kind ann
- tyDeclVar ∷ TyVarDecl tyname ann → TyDecl tyname uni ann
- type family HasUniques a ∷ Constraint
- newtype Binder name = Binder {
- unBinder ∷ name
- module PlutusCore.Version
- termAnn ∷ Term tyname name uni fun ann → ann
- typeAnn ∷ Type tyname uni ann → ann
- mapFun ∷ (fun → fun') → Term tyname name uni fun ann → Term tyname name uni fun' ann
- tyVarDeclAnn ∷ ∀ tyname ann. Lens' (TyVarDecl tyname ann) ann
- tyVarDeclName ∷ ∀ tyname ann tyname. Lens (TyVarDecl tyname ann) (TyVarDecl tyname ann) tyname tyname
- tyVarDeclKind ∷ ∀ tyname ann. Lens' (TyVarDecl tyname ann) (Kind ann)
- varDeclAnn ∷ ∀ tyname name uni ann. Lens' (VarDecl tyname name uni ann) ann
- varDeclName ∷ ∀ tyname name uni ann name. Lens (VarDecl tyname name uni ann) (VarDecl tyname name uni ann) name name
- varDeclType ∷ ∀ tyname name uni ann tyname uni. Lens (VarDecl tyname name uni ann) (VarDecl tyname name uni ann) (Type tyname uni ann) (Type tyname uni ann)
- tyDeclAnn ∷ ∀ tyname uni ann. Lens' (TyDecl tyname uni ann) ann
- tyDeclType ∷ ∀ tyname uni ann tyname uni. Lens (TyDecl tyname uni ann) (TyDecl tyname uni ann) (Type tyname uni ann) (Type tyname uni ann)
- tyDeclKind ∷ ∀ tyname uni ann. Lens' (TyDecl tyname uni ann) (Kind ann)
- progAnn ∷ ∀ tyname name uni fun ann. Lens' (Program tyname name uni fun ann) ann
- progVer ∷ ∀ tyname name uni fun ann. Lens' (Program tyname name uni fun ann) Version
- progTerm ∷ ∀ tyname name uni fun ann tyname name uni fun. Lens (Program tyname name uni fun ann) (Program tyname name uni fun ann) (Term tyname name uni fun ann) (Term tyname name uni fun ann)
Documentation
Instances
toPatFuncKind ∷ Kind () → Kind () Source #
argsFunKind ∷ Kind ann → [Kind ann] Source #
Extract all a_i
from a_0 -> a_1 -> ... -> r
.
data Type tyname uni ann Source #
A Kind
assigned to expressions.
TyVar ann tyname | Type variable |
TyFun ann (Type tyname uni ann) (Type tyname uni ann) | Function type |
TyIFix ann (Type tyname uni ann) (Type tyname uni ann) | Fix-point type, for constructing self-recursive types |
TyForall ann tyname (Kind ann) (Type tyname uni ann) | Polymorphic type |
TyBuiltin ann (SomeTypeIn uni) | Builtin type |
TyLam ann tyname (Kind ann) (Type tyname uni ann) | Type lambda |
TyApp ann (Type tyname uni ann) (Type tyname uni ann) | Type application |
TySOP ann [[Type tyname uni ann]] | Sum-of-products type |
Instances
splitFunTyParts ∷ Type tyname uni a → NonEmpty (Type tyname uni a) Source #
Get recursively all the domains and codomains of a type.
splitFunTyParts (A->B->C) = [A, B, C]
splitFunTyParts (X) = [X]
funTyArgs ∷ Type tyname uni a → [Type tyname uni a] Source #
Get the argument types of a function type.
funTyArgs (A->B->C) = [A, B]
funTyResultType ∷ Type tyname uni a → Type tyname uni a Source #
Get the result type of a function.
If not a function, then is the same as id
funResultType (A->B->C) = C
funResultType (X) = X
data Term tyname name uni fun ann Source #
Var ann name | a named variable |
LamAbs ann name (Type tyname uni ann) (Term tyname name uni fun ann) | lambda abstraction |
Apply ann (Term tyname name uni fun ann) (Term tyname name uni fun ann) | application |
TyAbs ann tyname (Kind ann) (Term tyname name uni fun ann) | type abstraction |
TyInst ann (Term tyname name uni fun ann) (Type tyname uni ann) | instantiation |
IWrap ann (Type tyname uni ann) (Type tyname uni ann) (Term tyname name uni fun ann) | wrapping |
Unwrap ann (Term tyname name uni fun ann) | unwrapping See Note [Constr tag type] |
Constr ann (Type tyname uni ann) Word64 [Term tyname name uni fun ann] | constructor |
Case ann (Type tyname uni ann) (Term tyname name uni fun ann) [Term tyname name uni fun ann] | case |
Constant ann (Some (ValueOf uni)) | constants |
Builtin ann fun | builtin functions |
Error ann (Type tyname uni ann) | fail with error |
Instances
data Program tyname name uni fun ann Source #
Instances
DefaultPrettyPlcStrategy (Program tyname name uni fun ann) ⇒ PrettyBy PrettyConfigPlc (Program tyname name uni fun ann) Source # | |
Defined in PlutusCore.Core.Instance.Pretty.Plc prettyBy ∷ PrettyConfigPlc → Program tyname name uni fun ann → Doc ann0 Source # prettyListBy ∷ PrettyConfigPlc → [Program tyname name uni fun ann] → Doc ann0 Source # | |
(PrettyClassicBy configName (Term tyname name uni fun ann), Pretty ann) ⇒ PrettyBy (PrettyConfigClassic configName) (Program tyname name uni fun ann) Source # | |
Defined in PlutusCore.Core.Instance.Pretty.Classic prettyBy ∷ PrettyConfigClassic configName → Program tyname name uni fun ann → Doc ann0 Source # prettyListBy ∷ PrettyConfigClassic configName → [Program tyname name uni fun ann] → Doc ann0 Source # | |
PrettyReadableBy configName (Term tyname name uni fun a) ⇒ PrettyBy (PrettyConfigReadable configName) (Program tyname name uni fun a) Source # | |
Defined in PlutusCore.Core.Instance.Pretty.Readable prettyBy ∷ PrettyConfigReadable configName → Program tyname name uni fun a → Doc ann Source # prettyListBy ∷ PrettyConfigReadable configName → [Program tyname name uni fun a] → Doc ann Source # | |
Functor (Program tyname name uni fun) Source # | |
(tyname ~ TyName, name ~ Name) ⇒ CollectScopeInfo (Program tyname name uni fun) Source # | |
Defined in PlutusCore.Core.Instance.Scoping collectScopeInfo ∷ Program tyname name uni fun NameAnn → ScopeErrorOrInfo Source # | |
(tyname ~ TyName, name ~ Name) ⇒ EstablishScoping (Program tyname name uni fun) Source # | |
Defined in PlutusCore.Core.Instance.Scoping | |
Generic (Program tyname name uni fun ann) Source # | |
(Show tyname, Show name, GShow uni, Everywhere uni Show, Show fun, Show ann, Closed uni) ⇒ Show (Program tyname name uni fun ann) Source # | |
(NFData tyname, NFData name, Everywhere uni NFData, NFData fun, NFData ann, Closed uni) ⇒ NFData (Program tyname name uni fun ann) Source # | |
Defined in PlutusCore.Core.Type | |
(Flat ann, Flat (Term tyname name uni fun ann)) ⇒ Flat (Program tyname name uni fun ann) Source # | |
(GEq uni, Closed uni, Everywhere uni Eq, Eq fun, Eq ann, Eq (Term tyname name uni fun ann)) ⇒ Eq (Program tyname name uni fun ann) Source # | |
HasUniques (Program tyname name uni fun ann) ⇒ Rename (Program tyname name uni fun ann) Source # | |
Defined in PlutusCore.Rename | |
(PrettyClassic tyname, PrettyClassic name, PrettyUni uni, Pretty fun, Pretty ann) ⇒ Pretty (Program tyname name uni fun ann) Source # | |
type Rep (Program tyname name uni fun ann) Source # | |
Defined in PlutusCore.Core.Type type Rep (Program tyname name uni fun ann) = D1 ('MetaData "Program" "PlutusCore.Core.Type" "plutus-core-1.36.0.0-inplace" 'False) (C1 ('MetaCons "Program" 'PrefixI 'True) (S1 ('MetaSel ('Just "_progAnn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ann) :*: (S1 ('MetaSel ('Just "_progVer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Version) :*: S1 ('MetaSel ('Just "_progTerm") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term tyname name uni fun ann))))) | |
type HasUniques (Program tyname name uni fun ann) Source # | |
Defined in PlutusCore.Core.Type |
type HasTermLevel uni = Includes uni Source #
Specifies that the given type is a built-in one and its values can be embedded into a Term
.
type family UniOf a ∷ Type → Type Source #
Extract the universe from a type.
Instances
type UniOf (Opaque val rep) Source # | |
Defined in PlutusCore.Builtin.Polymorphism | |
type UniOf (SomeConstant uni rep) Source # | |
Defined in PlutusCore.Builtin.Polymorphism | |
type UniOf (CkValue uni fun) Source # | |
Defined in PlutusCore.Evaluation.Machine.Ck | |
type UniOf (CekValue uni fun ann) Source # | |
type UniOf (Term name uni fun ann) Source # | |
Defined in UntypedPlutusCore.Core.Type | |
type UniOf (Term tyname name uni fun ann) Source # | |
Defined in PlutusCore.Core.Type |
newtype Normalized a Source #
Instances
data TyVarDecl tyname ann Source #
A "type variable declaration", i.e. a name and a kind for a type variable.
TyVarDecl | |
|
Instances
data VarDecl tyname name uni ann Source #
A "variable declaration", i.e. a name and a type for a variable.
VarDecl | |
|
Instances
(PrettyReadableBy configName tyname, PrettyReadableBy configName name, PrettyUni uni) ⇒ PrettyBy (PrettyConfigReadable configName) (VarDecl tyname name uni ann) Source # | |
Defined in PlutusCore.Core.Instance.Pretty.Readable prettyBy ∷ PrettyConfigReadable configName → VarDecl tyname name uni ann → Doc ann0 Source # prettyListBy ∷ PrettyConfigReadable configName → [VarDecl tyname name uni ann] → Doc ann0 Source # | |
Functor (VarDecl tyname name uni) Source # | |
Generic (VarDecl tyname name uni ann) Source # | |
(GShow uni, Show ann, Show name, Show tyname) ⇒ Show (VarDecl tyname name uni ann) Source # | |
(Closed uni, Flat ann, Flat tyname, Flat name) ⇒ Flat (VarDecl tyname name uni ann) Source # | |
HasUnique name TermUnique ⇒ HasUnique (VarDecl tyname name uni ann) TermUnique Source # | |
Defined in PlutusCore.Core.Type | |
type Rep (VarDecl tyname name uni ann) Source # | |
Defined in PlutusCore.Core.Type type Rep (VarDecl tyname name uni ann) = D1 ('MetaData "VarDecl" "PlutusCore.Core.Type" "plutus-core-1.36.0.0-inplace" 'False) (C1 ('MetaCons "VarDecl" 'PrefixI 'True) (S1 ('MetaSel ('Just "_varDeclAnn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ann) :*: (S1 ('MetaSel ('Just "_varDeclName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 name) :*: S1 ('MetaSel ('Just "_varDeclType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Type tyname uni ann))))) |
data TyDecl tyname uni ann Source #
A "type declaration", i.e. a kind for a type.
TyDecl | |
|
Instances
Functor (TyDecl tyname uni) Source # | |
Generic (TyDecl tyname uni ann) Source # | |
(GShow uni, Show ann, Show tyname) ⇒ Show (TyDecl tyname uni ann) Source # | |
type Rep (TyDecl tyname uni ann) Source # | |
Defined in PlutusCore.Core.Type type Rep (TyDecl tyname uni ann) = D1 ('MetaData "TyDecl" "PlutusCore.Core.Type" "plutus-core-1.36.0.0-inplace" 'False) (C1 ('MetaCons "TyDecl" 'PrefixI 'True) (S1 ('MetaSel ('Just "_tyDeclAnn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ann) :*: (S1 ('MetaSel ('Just "_tyDeclType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Type tyname uni ann)) :*: S1 ('MetaSel ('Just "_tyDeclKind") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Kind ann))))) |
type family HasUniques a ∷ Constraint Source #
All kinds of uniques an entity contains.
Instances
type HasUniques (Kind ann) Source # | |
Defined in PlutusCore.Core.Type | |
type HasUniques (Type tyname uni ann) Source # | |
Defined in PlutusCore.Core.Type | |
type HasUniques (Program name uni fun ann) Source # | |
Defined in UntypedPlutusCore.Core.Type | |
type HasUniques (Term name uni fun ann) Source # | |
Defined in UntypedPlutusCore.Core.Type | |
type HasUniques (Program tyname name uni fun ann) Source # | |
Defined in PlutusCore.Core.Type | |
type HasUniques (Term tyname name uni fun ann) Source # | |
Defined in PlutusCore.Core.Type type HasUniques (Term tyname name uni fun ann) = (HasUnique tyname TypeUnique, HasUnique name TermUnique) |
This is a wrapper to mark the place where the binder is introduced (i.e. LamAbs/TyAbs)
and not where it is actually used (TyVar/Var..).
This marking allows us to skip the (de)serialization of binders at LamAbs/TyAbs positions
iff name
is DeBruijn-encoded (level or index). See for example the instance of Flat
Instances
Functor Binder Source # | |
Show name ⇒ Show (Binder name) Source # | |
Flat (Binder DeBruijn) Source # | |
Flat (Binder FakeNamedDeBruijn) Source # | |
Defined in PlutusCore.Flat | |
Flat (Binder NamedDeBruijn) Source # | |
Defined in PlutusCore.Flat | |
Flat (Binder NamedTyDeBruijn) Source # | |
Defined in PlutusCore.Flat | |
Flat (Binder Name) Source # | |
Flat (Binder TyName) Source # | |
Eq name ⇒ Eq (Binder name) Source # | |
module PlutusCore.Version
Helper functions
mapFun ∷ (fun → fun') → Term tyname name uni fun ann → Term tyname name uni fun' ann Source #
Map a function over the set of built-in functions.
tyVarDeclAnn ∷ ∀ tyname ann. Lens' (TyVarDecl tyname ann) ann Source #
tyVarDeclName ∷ ∀ tyname ann tyname. Lens (TyVarDecl tyname ann) (TyVarDecl tyname ann) tyname tyname Source #
varDeclAnn ∷ ∀ tyname name uni ann. Lens' (VarDecl tyname name uni ann) ann Source #
varDeclName ∷ ∀ tyname name uni ann name. Lens (VarDecl tyname name uni ann) (VarDecl tyname name uni ann) name name Source #
varDeclType ∷ ∀ tyname name uni ann tyname uni. Lens (VarDecl tyname name uni ann) (VarDecl tyname name uni ann) (Type tyname uni ann) (Type tyname uni ann) Source #