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

PlutusCore.Builtin.Polymorphism

Synopsis

Documentation

newtype Opaque val (rep ∷ Type) Source #

The AST of a value with a Plutus type attached to it. The type is for the Plutus type checker to look at. Opaque can appear in the type of the denotation of a builtin.

Constructors

Opaque 

Fields

Instances

Instances details
KnownTypeAst tyname uni rep ⇒ KnownTypeAst tyname uni (Opaque val rep ∷ Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

Associated Types

type IsBuiltin uni (Opaque val rep) ∷ Bool Source #

type ToHoles uni (Opaque val rep) ∷ [Hole] Source #

type ToBinds uni acc (Opaque val rep) ∷ [Some TyNameRep] Source #

Methods

typeAstType0 tyname uni () Source #

uni ~ UniOf val ⇒ MakeKnownIn uni val (Opaque val rep) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownType

Methods

makeKnownOpaque val rep → BuiltinResult val Source #

uni ~ UniOf val ⇒ ReadKnownIn uni val (Opaque val rep) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownType

Methods

readKnown ∷ val → ReadKnownM (Opaque val rep) Source #

(TypeError NoConstraintsErrMsg ∷ Constraint) ⇒ Monoid (Opaque val rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

memptyOpaque val rep Source #

mappendOpaque val rep → Opaque val rep → Opaque val rep Source #

mconcat ∷ [Opaque val rep] → Opaque val rep Source #

(TypeError NoConstraintsErrMsg ∷ Constraint) ⇒ Semigroup (Opaque val rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

(<>)Opaque val rep → Opaque val rep → Opaque val rep Source #

sconcatNonEmpty (Opaque val rep) → Opaque val rep Source #

stimesIntegral b ⇒ b → Opaque val rep → Opaque val rep Source #

(TypeError NoConstraintsErrMsg ∷ Constraint) ⇒ Bounded (Opaque val rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

minBoundOpaque val rep Source #

maxBoundOpaque val rep Source #

(TypeError NoConstraintsErrMsg ∷ Constraint) ⇒ Enum (Opaque val rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

succOpaque val rep → Opaque val rep Source #

predOpaque val rep → Opaque val rep Source #

toEnumIntOpaque val rep Source #

fromEnumOpaque val rep → Int Source #

enumFromOpaque val rep → [Opaque val rep] Source #

enumFromThenOpaque val rep → Opaque val rep → [Opaque val rep] Source #

enumFromToOpaque val rep → Opaque val rep → [Opaque val rep] Source #

enumFromThenToOpaque val rep → Opaque val rep → Opaque val rep → [Opaque val rep] Source #

(TypeError NoConstraintsErrMsg ∷ Constraint) ⇒ Ix (Opaque val rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

range ∷ (Opaque val rep, Opaque val rep) → [Opaque val rep] Source #

index ∷ (Opaque val rep, Opaque val rep) → Opaque val rep → Int Source #

unsafeIndex ∷ (Opaque val rep, Opaque val rep) → Opaque val rep → Int Source #

inRange ∷ (Opaque val rep, Opaque val rep) → Opaque val rep → Bool Source #

rangeSize ∷ (Opaque val rep, Opaque val rep) → Int Source #

unsafeRangeSize ∷ (Opaque val rep, Opaque val rep) → Int Source #

(TypeError NoConstraintsErrMsg ∷ Constraint) ⇒ Num (Opaque val rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

(+)Opaque val rep → Opaque val rep → Opaque val rep Source #

(-)Opaque val rep → Opaque val rep → Opaque val rep Source #

(*)Opaque val rep → Opaque val rep → Opaque val rep Source #

negateOpaque val rep → Opaque val rep Source #

absOpaque val rep → Opaque val rep Source #

signumOpaque val rep → Opaque val rep Source #

fromIntegerIntegerOpaque val rep Source #

(TypeError NoConstraintsErrMsg ∷ Constraint) ⇒ Integral (Opaque val rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

quotOpaque val rep → Opaque val rep → Opaque val rep Source #

remOpaque val rep → Opaque val rep → Opaque val rep Source #

divOpaque val rep → Opaque val rep → Opaque val rep Source #

modOpaque val rep → Opaque val rep → Opaque val rep Source #

quotRemOpaque val rep → Opaque val rep → (Opaque val rep, Opaque val rep) Source #

divModOpaque val rep → Opaque val rep → (Opaque val rep, Opaque val rep) Source #

toIntegerOpaque val rep → Integer Source #

(TypeError NoConstraintsErrMsg ∷ Constraint) ⇒ Real (Opaque val rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

toRationalOpaque val rep → Rational Source #

(TypeError NoConstraintsErrMsg ∷ Constraint) ⇒ Eq (Opaque val rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

(==)Opaque val rep → Opaque val rep → Bool Source #

(/=)Opaque val rep → Opaque val rep → Bool Source #

(TypeError NoConstraintsErrMsg ∷ Constraint) ⇒ Ord (Opaque val rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

compareOpaque val rep → Opaque val rep → Ordering Source #

(<)Opaque val rep → Opaque val rep → Bool Source #

(<=)Opaque val rep → Opaque val rep → Bool Source #

(>)Opaque val rep → Opaque val rep → Bool Source #

(>=)Opaque val rep → Opaque val rep → Bool Source #

maxOpaque val rep → Opaque val rep → Opaque val rep Source #

minOpaque val rep → Opaque val rep → Opaque val rep Source #

HasConstant val ⇒ HasConstant (Opaque val rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

asConstantOpaque val rep → Either BuiltinError (Some (ValueOf (UniOf (Opaque val rep)))) Source #

fromConstantSome (ValueOf (UniOf (Opaque val rep))) → Opaque val rep Source #

ExMemoryUsage val ⇒ ExMemoryUsage (Opaque val rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

memoryUsageOpaque val rep → CostRose Source #

type ToBinds uni acc (Opaque val rep ∷ Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds uni acc (Opaque val rep ∷ Type) = ToBinds uni acc rep
type IsBuiltin uni (Opaque val rep ∷ Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (Opaque val rep ∷ Type) = 'False
type ToHoles uni (Opaque val rep ∷ Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles uni (Opaque val rep ∷ Type) = '[RepHole rep ∷ Hole]
type UniOf (Opaque val rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

type UniOf (Opaque val rep) = UniOf val

newtype SomeConstant uni (rep ∷ Type) Source #

For unlifting from the Constant constructor when the stored value is of a monomorphic built-in type

The rep parameter specifies how the type looks on the PLC side (i.e. just like with Opaque val rep).

Constructors

SomeConstant 

Fields

Instances

Instances details
KnownTypeAst tyname uni rep ⇒ KnownTypeAst tyname uni (SomeConstant uni rep ∷ Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

Associated Types

type IsBuiltin uni (SomeConstant uni rep) ∷ Bool Source #

type ToHoles uni (SomeConstant uni rep) ∷ [Hole] Source #

type ToBinds uni acc (SomeConstant uni rep) ∷ [Some TyNameRep] Source #

Methods

typeAstType0 tyname uni () Source #

HasConstantIn uni val ⇒ MakeKnownIn uni val (SomeConstant uni rep) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownType

Methods

makeKnownSomeConstant uni rep → BuiltinResult val Source #

HasConstantIn uni val ⇒ ReadKnownIn uni val (SomeConstant uni rep) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownType

Methods

readKnown ∷ val → ReadKnownM (SomeConstant uni rep) Source #

HasConstant (SomeConstant uni rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

(Everywhere uni ExMemoryUsage, Closed uni) ⇒ ExMemoryUsage (SomeConstant uni rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

memoryUsageSomeConstant uni rep → CostRose Source #

type ToBinds uni acc (SomeConstant uni rep ∷ Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds uni acc (SomeConstant uni rep ∷ Type) = ToBinds uni acc rep
type IsBuiltin uni (SomeConstant uni rep ∷ Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (SomeConstant uni rep ∷ Type) = 'False
type ToHoles uni (SomeConstant uni rep ∷ Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles uni (SomeConstant uni rep ∷ Type) = '[RepHole rep ∷ Hole]
type UniOf (SomeConstant uni rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

type UniOf (SomeConstant uni rep) = uni

data TyNameRep (kind ∷ Type) Source #

Representation of a type variable: its name and unique and an implicit kind.

Constructors

TyNameRep Symbol Nat 

Instances

Instances details
(name ~ ('TyNameRep text uniq ∷ TyNameRep kind), KnownSymbol text, KnownNat uniq, KnownKind kind, KnownTypeAst tyname uni a) ⇒ KnownTypeAst tyname uni (MetaForall name a ∷ Type) Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

Associated Types

type IsBuiltin uni (MetaForall name a) ∷ Bool Source #

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

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

Methods

typeAstType0 tyname uni () Source #

KnownMonotype val args res ⇒ KnownPolytype ('[] ∷ [Some TyNameRep]) val args res Source #

Once we've run out of type-level arguments, we start handling term-level ones.

Instance details

Defined in PlutusCore.Builtin.Meaning

(TypeError NoStandalonePolymorphicDataErrMsg ∷ Constraint) ⇒ Contains uni (TyVarRepTyNameRep kind → kind) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

knownUni ∷ uni (Esc TyVarRep) Source #

(KnownSymbol name, KnownNat uniq, KnownKind kind, KnownPolytype binds val args res) ⇒ KnownPolytype ('Some ('TyNameRep name uniq ∷ TyNameRep kind) ': binds) val args res Source #

Every type-level argument becomes a TypeSchemeAll.

Instance details

Defined in PlutusCore.Builtin.Meaning

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

Defined in PlutusCore.Examples.Builtins

type ToBinds uni acc (MetaForall name a ∷ Type) = ToBinds uni (Insert ('Some name) acc) a
type IsBuiltin uni (MetaForall name a ∷ Type) Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

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

Defined in PlutusCore.Examples.Builtins

type ToHoles uni (MetaForall name a ∷ Type) = '[TypeHole a ∷ Hole]

data family TyVarRep (name ∷ TyNameRep kind) ∷ kind Source #

Representation of an intrinsically-kinded type variable: a name.

Instances

Instances details
(tyname ~ TyName, name ~ ('TyNameRep text uniq ∷ TyNameRep a), KnownSymbol text, KnownNat uniq) ⇒ KnownTypeAst tyname uni (TyVarRep name ∷ a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

Associated Types

type IsBuiltin uni (TyVarRep name) ∷ Bool Source #

type ToHoles uni (TyVarRep name) ∷ [Hole] Source #

type ToBinds uni acc (TyVarRep name) ∷ [Some TyNameRep] Source #

Methods

typeAstType tyname uni () Source #

(TypeError NoStandalonePolymorphicDataErrMsg ∷ Constraint) ⇒ Contains uni (TyVarRepTyNameRep kind → kind) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

knownUni ∷ uni (Esc TyVarRep) Source #

type ToBinds uni acc (TyVarRep name ∷ a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds uni acc (TyVarRep name ∷ a) = Insert ('Some name) acc
type IsBuiltin uni (TyVarRep name ∷ a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (TyVarRep name ∷ a) = 'False
type ToHoles uni (TyVarRep name ∷ a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles uni (TyVarRep name ∷ a) = '[] ∷ [Hole]

data family TyAppRep (fun ∷ dom → cod) (arg ∷ dom) ∷ cod Source #

Representation of an intrinsically-kinded type application: a function and an argument.

Instances

Instances details
(KnownTypeAst tyname uni fun, KnownTypeAst tyname uni arg) ⇒ KnownTypeAst tyname uni (TyAppRep fun arg ∷ a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

Associated Types

type IsBuiltin uni (TyAppRep fun arg) ∷ Bool Source #

type ToHoles uni (TyAppRep fun arg) ∷ [Hole] Source #

type ToBinds uni acc (TyAppRep fun arg) ∷ [Some TyNameRep] Source #

Methods

typeAstType tyname uni () Source #

type ToBinds uni acc (TyAppRep fun arg ∷ a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds uni acc (TyAppRep fun arg ∷ a) = ToBinds uni (ToBinds uni acc fun) arg
type IsBuiltin uni (TyAppRep fun arg ∷ a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (TyAppRep fun arg ∷ a) = IsBuiltin uni fun && IsBuiltin uni arg
type ToHoles uni (TyAppRep fun arg ∷ a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles uni (TyAppRep fun arg ∷ a) = '[RepHole fun ∷ Hole, RepHole arg ∷ Hole]

data family TyForallRep (name ∷ TyNameRep kind) (a ∷ Type) ∷ Type Source #

Representation of of an intrinsically-kinded universal quantifier: a bound name and a body.

Instances

Instances details
(tyname ~ TyName, name ~ ('TyNameRep text uniq ∷ TyNameRep kind), KnownSymbol text, KnownNat uniq, KnownKind kind, KnownTypeAst tyname uni a) ⇒ KnownTypeAst tyname uni (TyForallRep name a ∷ Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

Associated Types

type IsBuiltin uni (TyForallRep name a) ∷ Bool Source #

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

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

Methods

typeAstType0 tyname uni () Source #

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

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds uni acc (TyForallRep name a ∷ Type) = Delete ('Some name) (ToBinds uni acc a)
type IsBuiltin uni (TyForallRep name a ∷ Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

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

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles uni (TyForallRep name a ∷ Type) = '[RepHole a ∷ Hole]

data family BuiltinHead x Source #

For annotating an uninstantiated built-in type, so that it gets handled by the right instance or type family.

Instances

Instances details
Contains uni f ⇒ KnownTypeAst tyname uni (BuiltinHead f ∷ a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

Associated Types

type IsBuiltin uni (BuiltinHead f) ∷ Bool Source #

type ToHoles uni (BuiltinHead f) ∷ [Hole] Source #

type ToBinds uni acc (BuiltinHead f) ∷ [Some TyNameRep] Source #

Methods

typeAstType tyname uni () Source #

type ToBinds uni acc (BuiltinHead f ∷ a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds uni acc (BuiltinHead f ∷ a) = acc
type IsBuiltin uni (BuiltinHead f ∷ a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (BuiltinHead f ∷ a) = 'True
type ToHoles uni (BuiltinHead f ∷ a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles uni (BuiltinHead f ∷ a) = '[] ∷ [Hole]

type family ElaborateBuiltin uni x Source #

Take an iterated application of a built-in type and elaborate every function application inside of it to TyAppRep and annotate the head with BuiltinHead.

The idea is that we don't need to process built-in types manually if we simply add some annotations for instance resolution to look for. Think what we'd have to do manually for, say, ToHoles: traverse the spine of the application and collect all the holes into a list, which is troubling, because type applications are left-nested and lists are right-nested, so we'd have to use accumulators or an explicit Reverse type family. And then we also have KnownTypeAst and ToBinds, so handling built-in types in a special way for each of those would be a hassle, especially given the fact that type-level Haskell is not exactly good at computing things. With the ElaborateBuiltin approach we get KnownTypeAst, ToHoles and ToBinds for free.

We make this an open type family, so that elaboration is customizable for each universe.

Instances

Instances details
type ElaborateBuiltin DefaultUni (x ∷ a) Source # 
Instance details

Defined in PlutusCore.Default.Universe

type family AllElaboratedArgs constr x where ... Source #

Take a constraint and use it to constrain every argument of a possibly 0-ary elaborated application of a built-in type.

Equations

AllElaboratedArgs constr (f `TyAppRep` x) = (constr x, AllElaboratedArgs constr f) 
AllElaboratedArgs _ (BuiltinHead _) = () 

class AllElaboratedArgs constr (ElaborateBuiltin uni x) ⇒ AllBuiltinArgs uni constr x Source #

Take a constraint and use it to constrain every argument of a possibly 0-ary application of a built-in type.

Instances

Instances details
AllElaboratedArgs constr (ElaborateBuiltin uni x) ⇒ AllBuiltinArgs uni constr (x ∷ a) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism