| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
PlutusCore.Builtin
Description
Reexports from modules from the Builtin folder.
Synopsis
- class Typeable (a :: k)
- newtype Opaque val rep = Opaque {
- unOpaque :: val
- data SingKind k where
- type HasTypeLevel (uni :: Type -> Type) (x :: a) = KnownTypeAst Void uni (ElaborateBuiltin uni x)
- type HasTermLevel (uni :: Type -> Type) = Includes uni :: a -> Constraint
- type HasTypeAndTermLevel (uni :: Type -> Type) (x :: a) = (HasTypeLevel uni x, HasTermLevel uni x)
- data BuiltinResult a
- = BuiltinSuccess a
- | BuiltinSuccessWithLogs (DList Text) a
- | BuiltinFailure (DList Text) BuiltinError
- builtinResultFailure :: BuiltinResult a
- emit :: Text -> BuiltinResult ()
- class HasConstant term where
- asConstant :: term -> Either BuiltinError (Some (ValueOf (UniOf term)))
- fromConstant :: Some (ValueOf (UniOf term)) -> term
- class KnownKind k where
- class KnownTypeAst tyname (uni :: Type -> Type) (x :: a) where
- data TypeScheme val (args :: [Type]) res where
- TypeSchemeResult :: forall res val. (Typeable res, KnownTypeAst TyName (UniOf val) res, MakeKnown val res) => TypeScheme val ('[] :: [Type]) res
- TypeSchemeArrow :: forall arg val (args1 :: [Type]) res. (Typeable arg, KnownTypeAst TyName (UniOf val) arg, MakeKnown val arg, ReadKnown val arg) => TypeScheme val args1 res -> TypeScheme val (arg ': args1) res
- TypeSchemeAll :: forall (text :: Symbol) (uniq :: Nat) kind val (args :: [Type]) res. (KnownSymbol text, KnownNat uniq, KnownKind kind) => Proxy '(text, uniq, kind) -> TypeScheme val args res -> TypeScheme val args res
- class (Typeable uni, Typeable fun, Bounded fun, Enum fun, Ix fun, Default (BuiltinSemanticsVariant fun)) => ToBuiltinMeaning (uni :: Type -> Type) fun where
- type CostingPart (uni :: Type -> Type) fun
- data BuiltinSemanticsVariant fun
- toBuiltinMeaning :: HasMeaningIn uni val => BuiltinSemanticsVariant fun -> fun -> BuiltinMeaning val (CostingPart uni fun)
- data family BuiltinSemanticsVariant fun
- data EvaluationError structural operational
- = StructuralError !structural
- | OperationalError !operational
- newtype UnliftingError = MkUnliftingError {}
- data BuiltinError
- notAConstant :: BuiltinError
- mkTyBuiltin :: forall a (x :: a) (uni :: Type -> Type) ann tyname. HasTypeLevel uni x => ann -> Type tyname uni ann
- class ToKind (uni :: Type -> Type) where
- toSingKind :: forall k (a :: k). uni (Esc a) -> SingKind k
- data BuiltinsRuntime fun val = BuiltinsRuntime {
- unBuiltinsRuntime :: fun -> BuiltinRuntime val
- class CaseBuiltin (uni :: Type -> Type) where
- data HeadSpine err a b
- type HasConstantIn (uni :: Type -> Type) term = (UniOf term ~ uni, HasConstant term)
- fromValueOf :: forall a term. HasConstant term => UniOf term (Esc a) -> a -> term
- fromValue :: forall a term. (HasConstant term, HasTermLevel (UniOf term) a) => a -> term
- class GEqL (f :: Type -> Type) a where
- geqL :: f (Esc a) -> f (Esc b) -> EvaluationResult (a :~: b)
- newtype LoopBreaker (uni :: Type -> Type) a = LoopBreaker (uni a)
- type KnownBuiltinTypeIn (uni :: Type -> Type) val a = (HasConstantIn uni val, PrettyParens (SomeTypeIn uni), GEqL uni a, HasTermLevel uni a)
- type KnownBuiltinType val a = KnownBuiltinTypeIn (UniOf val) val a
- type ReadKnownM = Either BuiltinError
- data Spine a
- headSpine :: a -> [b] -> HeadSpine err a b
- type MonoHeadSpine err a = HeadSpine err a a
- class uni ~ UniOf val => MakeKnownIn (uni :: Type -> Type) val a where
- makeKnown :: a -> BuiltinResult val
- readKnownConstant :: KnownBuiltinType val a => val -> ReadKnownM a
- type MakeKnown val = MakeKnownIn (UniOf val) val
- class uni ~ UniOf val => ReadKnownIn (uni :: Type -> Type) val a where
- readKnown :: val -> ReadKnownM a
- type ReadKnown val = ReadKnownIn (UniOf val) val
- makeKnownOrFail :: forall (uni :: Type -> Type) val a. MakeKnownIn uni val a => a -> EvaluationResult val
- readKnownSelf :: (ReadKnown val a, BuiltinErrorToEvaluationError structural operational) => val -> Either (ErrorWithCause (EvaluationError structural operational) val) a
- data TyNameRep kind = TyNameRep Symbol Nat
- data family TyVarRep (name :: TyNameRep kind) :: kind
- data family TyAppRep (fun :: dom -> cod) (arg :: dom) :: cod
- data family TyForallRep (name :: TyNameRep kind) a
- data Hole
- data family RepHole (x :: a) :: hole
- data family TypeHole a :: hole
- type family RunHole (hole :: Type -> Type) :: a -> Hole where ...
- type KnownBuiltinTypeAst tyname (uni :: Type -> Type) (x :: a) = AllBuiltinArgs uni (KnownTypeAst tyname uni :: Type -> Constraint) x
- toTypeAst :: forall a tyname (uni :: Type -> Type) (x :: a) proxy. KnownTypeAst tyname uni x => proxy x -> Type tyname uni ()
- type family Insert (x :: a) (xs :: [a]) :: [a] where ...
- type family Delete (x :: a) (xs :: [a]) :: [a] where ...
- type family FoldArgs (args :: [Type]) res where ...
- newtype SomeConstant (uni :: Type -> Type) rep = SomeConstant {
- unSomeConstant :: Some (ValueOf uni)
- data family BuiltinHead (x :: a) :: a
- data family LastArg x y
- type family ElaborateBuiltin (uni :: Type -> Type) (x :: a) :: a
- type family AllElaboratedArgs (constr :: Type -> Constraint) (x :: a) where ...
- class AllElaboratedArgs constr (ElaborateBuiltin uni x) => AllBuiltinArgs (uni :: Type -> Type) (constr :: Type -> Constraint) (x :: a)
- newtype UnliftingEvaluationError = MkUnliftingEvaluationError {}
- underTypeError :: BuiltinError
- operationalUnliftingError :: Text -> BuiltinError
- structuralUnliftingError :: Text -> BuiltinError
- withLogs :: DList Text -> BuiltinResult a -> BuiltinResult a
- throwing :: MonadError e m => AReview e t -> t -> m x
- throwing_ :: MonadError e m => AReview e () -> m x
- data BuiltinRuntime val
- = BuiltinCostedResult ExBudgetStream ~(BuiltinResult val)
- | BuiltinExpectArgument (val -> BuiltinRuntime val)
- | BuiltinExpectForce (BuiltinRuntime val)
- class (Everywhere uni (ImplementedKnownTypeAst uni), Everywhere uni (ImplementedReadKnownIn uni), Everywhere uni (ImplementedMakeKnownIn uni)) => TestTypesFromTheUniverseAreAllKnown (uni :: Type -> Type)
- argProxy :: forall val arg (args :: [Type]) res. TypeScheme val (arg ': args) res -> Proxy arg
- typeSchemeToType :: forall val (args :: [Type]) res. TypeScheme val args res -> Type TyName (UniOf val) ()
- withSingKind :: Kind ann -> (forall k. SingKind k -> r) -> r
- bringKnownKind :: SingKind k -> (KnownKind k => r) -> r
- withKnownKind :: Kind ann -> (forall k. KnownKind k => Proxy k -> r) -> r
- demoteKind :: SingKind k -> Kind ()
- kindOfBuiltinType :: forall {k} uni (a :: k). ToKind uni => uni (Esc a) -> Kind ()
- type family ToHoles (uni :: Type -> Type) (hole :: Type -> Type) (x :: a) :: [Hole]
- type family ToBinds (uni :: Type -> Type) (acc :: [Some TyNameRep]) (x :: a) :: [Some TyNameRep]
- type family IsBuiltin (uni :: Type -> Type) (x :: a) :: Bool
- builtinRuntimeFailure :: BuiltinError -> BuiltinRuntime val
- lookupBuiltin :: fun -> BuiltinsRuntime fun val -> BuiltinRuntime val
- class MakeBuiltinMeaning a val where
- makeBuiltinMeaning :: a -> (cost -> FoldArgs (GetArgs a) ExBudgetStream) -> BuiltinMeaning val cost
- data BuiltinMeaning val cost = BuiltinMeaning (TypeScheme val args res) ~(FoldArgs args res) (cost -> BuiltinRuntime val)
- type HasMeaningIn (uni :: Type -> Type) val = (Typeable val, ExMemoryUsage val, HasConstantIn uni val)
- type family CostingPart (uni :: Type -> Type) fun
- withTypeSchemeOfBuiltinFunction :: (ToBuiltinMeaning (UniOf val) fun, ExMemoryUsage val, Typeable val, HasConstant val) => BuiltinSemanticsVariant fun -> fun -> (forall (args :: [Type]) res. TypeScheme val args res -> r) -> r
- typeOfBuiltinFunction :: forall (uni :: Type -> Type) fun. ToBuiltinMeaning uni fun => BuiltinSemanticsVariant fun -> fun -> Type TyName uni ()
- type family GetArgs a :: [Type] where ...
- class KnownMonotype val (args :: [Type]) res where
- knownMonotype :: TypeScheme val args res
- toMonoF :: ReadKnownM (FoldArgs args res, FoldArgs args ExBudgetStream) -> BuiltinRuntime val
- class KnownMonotype val args res => KnownPolytype (binds :: [Some TyNameRep]) val (args :: [Type]) res where
- knownPolytype :: TypeScheme val args res
- toPolyF :: ReadKnownM (FoldArgs args res, FoldArgs args ExBudgetStream) -> BuiltinRuntime val
- type family ThrowOnBothEmpty (binds :: [Some TyNameRep]) (args :: [Type]) (isBuiltin :: Bool) a where ...
- toBuiltinRuntime :: cost -> BuiltinMeaning val cost -> BuiltinRuntime val
- toBuiltinsRuntime :: forall cost (uni :: Type -> Type) fun val. (cost ~ CostingPart uni fun, ToBuiltinMeaning uni fun, HasMeaningIn uni val) => BuiltinSemanticsVariant fun -> cost -> BuiltinsRuntime fun val
- class AnnotateCaseBuiltin (uni :: Type -> Type) where
- data CaserBuiltin (uni :: Type -> Type) = CaserBuiltin {}
- unavailableCaserBuiltin :: forall (uni :: Type -> Type). Int -> CaserBuiltin uni
Documentation
class Typeable (a :: k) Source #
The class Typeable allows a concrete representation of a type to
be calculated.
Minimal complete definition
typeRep#
newtype Opaque val rep 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.
Instances
| KnownTypeAst tyname uni rep => KnownTypeAst tyname uni (Opaque val rep :: Type) Source # | |
| uni ~ UniOf val => MakeKnownIn uni val (Opaque val rep) Source # | |
Defined in PlutusCore.Builtin.KnownType Methods makeKnown :: Opaque val rep -> BuiltinResult val Source # | |
| uni ~ UniOf val => ReadKnownIn uni val (Opaque val rep) Source # | |
Defined in PlutusCore.Builtin.KnownType Methods readKnown :: val -> ReadKnownM (Opaque val rep) Source # | |
| (TypeError NoConstraintsErrMsg :: Constraint) => Monoid (Opaque val rep) Source # | |
| (TypeError NoConstraintsErrMsg :: Constraint) => Semigroup (Opaque val rep) Source # | |
| (TypeError NoConstraintsErrMsg :: Constraint) => Bounded (Opaque val rep) Source # | |
| (TypeError NoConstraintsErrMsg :: Constraint) => Enum (Opaque val rep) Source # | |
Defined in PlutusCore.Builtin.Polymorphism Methods succ :: Opaque val rep -> Opaque val rep Source # pred :: Opaque val rep -> Opaque val rep Source # toEnum :: Int -> Opaque val rep Source # fromEnum :: Opaque val rep -> Int Source # enumFrom :: Opaque val rep -> [Opaque val rep] Source # enumFromThen :: Opaque val rep -> Opaque val rep -> [Opaque val rep] Source # enumFromTo :: Opaque val rep -> Opaque val rep -> [Opaque val rep] Source # enumFromThenTo :: Opaque val rep -> Opaque val rep -> Opaque val rep -> [Opaque val rep] Source # | |
| (TypeError NoConstraintsErrMsg :: Constraint) => Ix (Opaque val rep) Source # | |
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 # | |
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 # negate :: Opaque val rep -> Opaque val rep Source # abs :: Opaque val rep -> Opaque val rep Source # signum :: Opaque val rep -> Opaque val rep Source # fromInteger :: Integer -> Opaque val rep Source # | |
| (TypeError NoConstraintsErrMsg :: Constraint) => Integral (Opaque val rep) Source # | |
Defined in PlutusCore.Builtin.Polymorphism Methods quot :: Opaque val rep -> Opaque val rep -> Opaque val rep Source # rem :: Opaque val rep -> Opaque val rep -> Opaque val rep Source # div :: Opaque val rep -> Opaque val rep -> Opaque val rep Source # mod :: Opaque val rep -> Opaque val rep -> Opaque val rep Source # quotRem :: Opaque val rep -> Opaque val rep -> (Opaque val rep, Opaque val rep) Source # divMod :: Opaque val rep -> Opaque val rep -> (Opaque val rep, Opaque val rep) Source # | |
| (TypeError NoConstraintsErrMsg :: Constraint) => Real (Opaque val rep) Source # | |
Defined in PlutusCore.Builtin.Polymorphism Methods toRational :: Opaque val rep -> Rational Source # | |
| (TypeError NoConstraintsErrMsg :: Constraint) => Eq (Opaque val rep) Source # | |
| (TypeError NoConstraintsErrMsg :: Constraint) => Ord (Opaque val rep) Source # | |
Defined in PlutusCore.Builtin.Polymorphism Methods compare :: Opaque 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 # max :: Opaque val rep -> Opaque val rep -> Opaque val rep Source # min :: Opaque val rep -> Opaque val rep -> Opaque val rep Source # | |
| HasConstant val => HasConstant (Opaque val rep) Source # | |
Defined in PlutusCore.Builtin.Polymorphism | |
| ExMemoryUsage val => ExMemoryUsage (Opaque val rep) Source # | |
Defined in PlutusCore.Builtin.Polymorphism Methods memoryUsage :: Opaque val rep -> CostRose Source # | |
| type ToBinds uni acc (Opaque val rep :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type ToHoles uni _1 (Opaque val rep :: Type) Source # | |
| type IsBuiltin uni (Opaque val rep :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type UniOf (Opaque val rep) Source # | |
Defined in PlutusCore.Builtin.Polymorphism | |
type HasTypeLevel (uni :: Type -> Type) (x :: a) = KnownTypeAst Void uni (ElaborateBuiltin uni x) Source #
Specifies that the given type is a built-in one and can be embedded into a Type.
type HasTermLevel (uni :: Type -> Type) = Includes uni :: a -> Constraint Source #
Specifies that the given type is a built-in one and its values can be embedded into a Term.
type HasTypeAndTermLevel (uni :: Type -> Type) (x :: a) = (HasTypeLevel uni x, HasTermLevel uni x) Source #
The product of HasTypeLevel and HasTermLevel.
data BuiltinResult a Source #
The monad that makeKnown runs in.
Equivalent to ExceptT BuiltinError (Writer (DList Text)), except optimized in two ways:
- everything is strict
- has the
BuiltinSuccessconstructor that is used for returning a value with no logs attached, which is the most common case for us, so it helps a lot not to construct and deconstruct a redundant tuple
Moving from ExceptT BuiltinError (Writer (DList Text)) to this data type gave us a speedup of
8% of total evaluation time.
Logs are represented as a DList, because we don't particularly care about the efficiency of
logging, since there's no logging on the chain and builtins don't emit much anyway. Otherwise
we'd have to use text-builder or text-builder-linear or something of this sort.
Constructors
| BuiltinSuccess a | |
| BuiltinSuccessWithLogs (DList Text) a | |
| BuiltinFailure (DList Text) BuiltinError |
Instances
emit :: Text -> BuiltinResult () Source #
Add a log line to the logs.
class HasConstant term where Source #
Ensures that term has a Constant-like constructor to lift values to and unlift values from.
Methods
asConstant :: term -> Either BuiltinError (Some (ValueOf (UniOf term))) Source #
Unwrap from a Constant-like constructor throwing an UnliftingError if the provided
term is not a wrapped Haskell value.
fromConstant :: Some (ValueOf (UniOf term)) -> term Source #
Wrap a Haskell value as a term.
Instances
| HasConstant val => HasConstant (Opaque val rep) Source # | |
Defined in PlutusCore.Builtin.Polymorphism | |
| HasConstant (SomeConstant uni rep) Source # | |
Defined in PlutusCore.Builtin.Polymorphism Methods asConstant :: SomeConstant uni rep -> Either BuiltinError (Some (ValueOf (UniOf (SomeConstant uni rep)))) Source # fromConstant :: Some (ValueOf (UniOf (SomeConstant uni rep))) -> SomeConstant uni rep Source # | |
| HasConstant (CkValue uni fun) Source # | |
Defined in PlutusCore.Evaluation.Machine.Ck | |
| HasConstant (CekValue uni fun ann) Source # | |
| HasConstant (Term name uni fun ()) Source # | |
Defined in UntypedPlutusCore.Core.Type | |
| HasConstant (Term TyName Name uni fun ()) Source # | |
class KnownKind k where Source #
For reifying Haskell kinds representing Plutus kinds at the term level.
class KnownTypeAst tyname (uni :: Type -> Type) (x :: a) where Source #
This class allows one to convert the type-level Haskell representation of a Plutus type into the corresponding Plutus type. Associated type families are needed to help elaboration.
Depending on the universe converting a Haskell type to a Plutus team can give different results
(e.g. Int can be a built-in type instead of being encoded via built-in Integer), hence this
class takes a uni argument. Plus, elaboration is universe-specific too.
Minimal complete definition
Nothing
Associated Types
type IsBuiltin (uni :: Type -> Type) (x :: a) :: Bool Source #
Whether x is a built-in type.
type IsBuiltin (uni :: Type -> Type) (x :: a) = IsBuiltin uni (ElaborateBuiltin uni x)
type ToHoles (uni :: Type -> Type) (hole :: Type -> Type) (x :: a) :: [Hole] Source #
Return every part of the type that can be a to-be-instantiated type variable.
For example, in Integer there's no such types and in (a, b) it's the two arguments
(a and b) and the same applies to a -> b (to mention a type that is not built-in).
Takes a hole in the GHC.Type -> GHC.Type form (a convention originally adopted in the
elaborator, perhaps not a very helpful one), which can be turned into an actual Hole via
RunHole.
type ToHoles (uni :: Type -> Type) (hole :: Type -> Type) (x :: a) = ToHoles uni hole (ElaborateBuiltin uni x)
type ToBinds (uni :: Type -> Type) (acc :: [Some TyNameRep]) (x :: a) :: [Some TyNameRep] Source #
Collect all unique variables (a variable consists of a textual name, a unique and a kind) in an accumulator and return the accumulator once a leaf is reached.
Methods
typeAst :: Type tyname uni () Source #
The Plutus counterpart of the x type.
default typeAst :: forall. KnownTypeAst tyname uni (ElaborateBuiltin uni x) => Type tyname uni () Source #
Instances
| tyname ~ TyName => KnownTypeAst tyname DefaultUni Void Source # | |||||||||||||
Defined in PlutusCore.Examples.Builtins Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownTypeAst tyname DefaultUni Int16 Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownTypeAst tyname DefaultUni Int32 Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownTypeAst tyname DefaultUni Int64 Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownTypeAst tyname DefaultUni Int8 Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownTypeAst tyname DefaultUni Word16 Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownTypeAst tyname DefaultUni Word32 Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownTypeAst tyname DefaultUni Word64 Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownTypeAst tyname DefaultUni Word8 Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownBuiltinTypeAst tyname DefaultUni ByteString => KnownTypeAst tyname DefaultUni ByteString Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownBuiltinTypeAst tyname DefaultUni Element => KnownTypeAst tyname DefaultUni Element Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownBuiltinTypeAst tyname DefaultUni Element => KnownTypeAst tyname DefaultUni Element Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownBuiltinTypeAst tyname DefaultUni MlResult => KnownTypeAst tyname DefaultUni MlResult Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownBuiltinTypeAst tyname DefaultUni Data => KnownTypeAst tyname DefaultUni Data Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownTypeAst tyname DefaultUni DataNodeCount Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownTypeAst tyname DefaultUni IntegerCostedLiterally Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownTypeAst tyname DefaultUni NumBytesCostedAsNumWords Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownTypeAst tyname DefaultUni ValueMaxDepth Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownTypeAst tyname DefaultUni ValueTotalSize Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownBuiltinTypeAst tyname DefaultUni Value => KnownTypeAst tyname DefaultUni Value Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownBuiltinTypeAst tyname DefaultUni Text => KnownTypeAst tyname DefaultUni Text Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownBuiltinTypeAst tyname DefaultUni Integer => KnownTypeAst tyname DefaultUni Integer Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownTypeAst tyname DefaultUni Natural Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownBuiltinTypeAst tyname DefaultUni () => KnownTypeAst tyname DefaultUni () Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownBuiltinTypeAst tyname DefaultUni Bool => KnownTypeAst tyname DefaultUni Bool Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownTypeAst tyname DefaultUni Int Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownTypeAst tyname DefaultUni Word Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownBuiltinTypeAst tyname DefaultUni (Vector a) => KnownTypeAst tyname DefaultUni (Vector a :: Type) Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownBuiltinTypeAst tyname DefaultUni [a] => KnownTypeAst tyname DefaultUni ([a] :: Type) Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownTypeAst tyname uni a => KnownTypeAst tyname uni (BuiltinResult a :: Type) Source # | |||||||||||||
Defined in PlutusCore.Builtin.KnownTypeAst Associated Types
| |||||||||||||
| KnownTypeAst tyname uni a => KnownTypeAst tyname uni (EvaluationResult a :: Type) Source # | |||||||||||||
Defined in PlutusCore.Builtin.KnownTypeAst Associated Types
| |||||||||||||
| (tyname ~ TyName, KnownTypeAst tyname uni a) => KnownTypeAst tyname uni (PlcListRep a :: Type) Source # | |||||||||||||
Defined in PlutusCore.Examples.Builtins Associated Types
| |||||||||||||
| KnownBuiltinTypeAst tyname DefaultUni (a, b) => KnownTypeAst tyname DefaultUni ((a, b) :: Type) Source # | |||||||||||||
Defined in PlutusCore.Default.Universe Associated Types
Methods typeAst :: Type tyname DefaultUni () Source # | |||||||||||||
| KnownTypeAst tyname uni y => KnownTypeAst tyname uni (LastArg x y :: Type) Source # | |||||||||||||
| KnownTypeAst tyname uni rep => KnownTypeAst tyname uni (Opaque val rep :: Type) Source # | |||||||||||||
| KnownTypeAst tyname uni rep => KnownTypeAst tyname uni (SomeConstant uni rep :: Type) Source # | |||||||||||||
Defined in PlutusCore.Builtin.KnownTypeAst Associated Types
| |||||||||||||
| (KnownTypeAst tyname uni a, KnownTypeAst tyname uni b) => KnownTypeAst tyname uni (a -> b :: Type) Source # | |||||||||||||
| Contains uni f => KnownTypeAst tyname uni (BuiltinHead f :: a) Source # | |||||||||||||
Defined in PlutusCore.Builtin.KnownTypeAst Associated Types
| |||||||||||||
| (tyname ~ TyName, name ~ ('TyNameRep text uniq :: TyNameRep a), KnownSymbol text, KnownNat uniq) => KnownTypeAst tyname uni (TyVarRep name :: a) Source # | |||||||||||||
| (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 # | |||||||||||||
Defined in PlutusCore.Builtin.KnownTypeAst Associated Types
| |||||||||||||
| (name ~ ('TyNameRep text uniq :: TyNameRep kind), KnownSymbol text, KnownNat uniq, KnownKind kind, KnownTypeAst tyname uni a) => KnownTypeAst tyname uni (MetaForall name a :: Type) Source # | |||||||||||||
Defined in PlutusCore.Examples.Builtins Associated Types
| |||||||||||||
| (KnownTypeAst tyname uni fun, KnownTypeAst tyname uni arg) => KnownTypeAst tyname uni (TyAppRep fun arg :: a) Source # | |||||||||||||
data TypeScheme val (args :: [Type]) res where Source #
The type of type schemes of built-in functions.
args is a list of types of arguments, res is the resulting type.
E.g. Text -> Bool -> Integer is encoded as TypeScheme val [Text, Bool] Integer.
Constructors
| TypeSchemeResult :: forall res val. (Typeable res, KnownTypeAst TyName (UniOf val) res, MakeKnown val res) => TypeScheme val ('[] :: [Type]) res | |
| TypeSchemeArrow :: forall arg val (args1 :: [Type]) res. (Typeable arg, KnownTypeAst TyName (UniOf val) arg, MakeKnown val arg, ReadKnown val arg) => TypeScheme val args1 res -> TypeScheme val (arg ': args1) res infixr 9 | |
| TypeSchemeAll :: forall (text :: Symbol) (uniq :: Nat) kind val (args :: [Type]) res. (KnownSymbol text, KnownNat uniq, KnownKind kind) => Proxy '(text, uniq, kind) -> TypeScheme val args res -> TypeScheme val args res |
Instances
| Show (TypeScheme val args res) Source # | |
Defined in PlutusCore.Builtin.TypeScheme | |
class (Typeable uni, Typeable fun, Bounded fun, Enum fun, Ix fun, Default (BuiltinSemanticsVariant fun)) => ToBuiltinMeaning (uni :: Type -> Type) fun where Source #
A type class for "each function from a set of built-in functions has a BuiltinMeaning".
Associated Types
type CostingPart (uni :: Type -> Type) fun Source #
The cost part of BuiltinMeaning.
data BuiltinSemanticsVariant fun Source #
See Note [Builtin semantics variants]
Methods
toBuiltinMeaning :: HasMeaningIn uni val => BuiltinSemanticsVariant fun -> fun -> BuiltinMeaning val (CostingPart uni fun) Source #
Get the BuiltinMeaning of a built-in function.
Instances
| uni ~ DefaultUni => ToBuiltinMeaning uni DefaultFun Source # | |||||||||
Defined in PlutusCore.Default.Builtins Associated Types
Methods toBuiltinMeaning :: HasMeaningIn uni val => BuiltinSemanticsVariant DefaultFun -> DefaultFun -> BuiltinMeaning val (CostingPart uni DefaultFun) Source # | |||||||||
| uni ~ DefaultUni => ToBuiltinMeaning uni ExtensionFun Source # | |||||||||
Defined in PlutusCore.Examples.Builtins Associated Types
Methods toBuiltinMeaning :: HasMeaningIn uni val => BuiltinSemanticsVariant ExtensionFun -> ExtensionFun -> BuiltinMeaning val (CostingPart uni ExtensionFun) Source # | |||||||||
| (ToBuiltinMeaning uni fun1, ToBuiltinMeaning uni fun2, Default (BuiltinSemanticsVariant fun1), Default (BuiltinSemanticsVariant fun2)) => ToBuiltinMeaning uni (Either fun1 fun2) Source # | |||||||||
Defined in PlutusCore.Examples.Builtins Associated Types
Methods toBuiltinMeaning :: HasMeaningIn uni val => BuiltinSemanticsVariant (Either fun1 fun2) -> Either fun1 fun2 -> BuiltinMeaning val (CostingPart uni (Either fun1 fun2)) Source # | |||||||||
data family BuiltinSemanticsVariant fun Source #
See Note [Builtin semantics variants]
Instances
| Bounded (BuiltinSemanticsVariant DefaultFun) Source # | |||||
Defined in PlutusCore.Default.Builtins | |||||
| Bounded (BuiltinSemanticsVariant ExtensionFun) Source # | |||||
Defined in PlutusCore.Examples.Builtins | |||||
| Enum (BuiltinSemanticsVariant DefaultFun) Source # | |||||
Defined in PlutusCore.Default.Builtins Methods succ :: BuiltinSemanticsVariant DefaultFun -> BuiltinSemanticsVariant DefaultFun Source # pred :: BuiltinSemanticsVariant DefaultFun -> BuiltinSemanticsVariant DefaultFun Source # toEnum :: Int -> BuiltinSemanticsVariant DefaultFun Source # fromEnum :: BuiltinSemanticsVariant DefaultFun -> Int Source # enumFrom :: BuiltinSemanticsVariant DefaultFun -> [BuiltinSemanticsVariant DefaultFun] Source # enumFromThen :: BuiltinSemanticsVariant DefaultFun -> BuiltinSemanticsVariant DefaultFun -> [BuiltinSemanticsVariant DefaultFun] Source # enumFromTo :: BuiltinSemanticsVariant DefaultFun -> BuiltinSemanticsVariant DefaultFun -> [BuiltinSemanticsVariant DefaultFun] Source # enumFromThenTo :: BuiltinSemanticsVariant DefaultFun -> BuiltinSemanticsVariant DefaultFun -> BuiltinSemanticsVariant DefaultFun -> [BuiltinSemanticsVariant DefaultFun] Source # | |||||
| Enum (BuiltinSemanticsVariant ExtensionFun) Source # | |||||
Defined in PlutusCore.Examples.Builtins Methods succ :: BuiltinSemanticsVariant ExtensionFun -> BuiltinSemanticsVariant ExtensionFun Source # pred :: BuiltinSemanticsVariant ExtensionFun -> BuiltinSemanticsVariant ExtensionFun Source # toEnum :: Int -> BuiltinSemanticsVariant ExtensionFun Source # fromEnum :: BuiltinSemanticsVariant ExtensionFun -> Int Source # enumFrom :: BuiltinSemanticsVariant ExtensionFun -> [BuiltinSemanticsVariant ExtensionFun] Source # enumFromThen :: BuiltinSemanticsVariant ExtensionFun -> BuiltinSemanticsVariant ExtensionFun -> [BuiltinSemanticsVariant ExtensionFun] Source # enumFromTo :: BuiltinSemanticsVariant ExtensionFun -> BuiltinSemanticsVariant ExtensionFun -> [BuiltinSemanticsVariant ExtensionFun] Source # enumFromThenTo :: BuiltinSemanticsVariant ExtensionFun -> BuiltinSemanticsVariant ExtensionFun -> BuiltinSemanticsVariant ExtensionFun -> [BuiltinSemanticsVariant ExtensionFun] Source # | |||||
| Generic (BuiltinSemanticsVariant DefaultFun) Source # | |||||
Defined in PlutusCore.Default.Builtins Associated Types
Methods from :: BuiltinSemanticsVariant DefaultFun -> Rep (BuiltinSemanticsVariant DefaultFun) x Source # to :: Rep (BuiltinSemanticsVariant DefaultFun) x -> BuiltinSemanticsVariant DefaultFun Source # | |||||
| Show (BuiltinSemanticsVariant DefaultFun) Source # | |||||
Defined in PlutusCore.Default.Builtins Methods showsPrec :: Int -> BuiltinSemanticsVariant DefaultFun -> ShowS Source # show :: BuiltinSemanticsVariant DefaultFun -> String Source # showList :: [BuiltinSemanticsVariant DefaultFun] -> ShowS Source # | |||||
| Show (BuiltinSemanticsVariant ExtensionFun) Source # | |||||
Defined in PlutusCore.Examples.Builtins Methods showsPrec :: Int -> BuiltinSemanticsVariant ExtensionFun -> ShowS Source # show :: BuiltinSemanticsVariant ExtensionFun -> String Source # showList :: [BuiltinSemanticsVariant ExtensionFun] -> ShowS Source # | |||||
| (Default (BuiltinSemanticsVariant fun1), Default (BuiltinSemanticsVariant fun2)) => Default (BuiltinSemanticsVariant (Either fun1 fun2)) Source # | |||||
Defined in PlutusCore.Examples.Builtins Methods def :: BuiltinSemanticsVariant (Either fun1 fun2) # | |||||
| Default (BuiltinSemanticsVariant DefaultFun) Source # | |||||
Defined in PlutusCore.Default.Builtins Methods | |||||
| Default (BuiltinSemanticsVariant ExtensionFun) Source # | |||||
Defined in PlutusCore.Examples.Builtins Methods | |||||
| NFData (BuiltinSemanticsVariant DefaultFun) Source # | |||||
Defined in PlutusCore.Default.Builtins Methods rnf :: BuiltinSemanticsVariant DefaultFun -> () Source # | |||||
| Eq (BuiltinSemanticsVariant DefaultFun) Source # | |||||
Defined in PlutusCore.Default.Builtins | |||||
| Eq (BuiltinSemanticsVariant ExtensionFun) Source # | |||||
Defined in PlutusCore.Examples.Builtins | |||||
| Ord (BuiltinSemanticsVariant DefaultFun) Source # | |||||
Defined in PlutusCore.Default.Builtins Methods compare :: BuiltinSemanticsVariant DefaultFun -> BuiltinSemanticsVariant DefaultFun -> Ordering Source # (<) :: BuiltinSemanticsVariant DefaultFun -> BuiltinSemanticsVariant DefaultFun -> Bool Source # (<=) :: BuiltinSemanticsVariant DefaultFun -> BuiltinSemanticsVariant DefaultFun -> Bool Source # (>) :: BuiltinSemanticsVariant DefaultFun -> BuiltinSemanticsVariant DefaultFun -> Bool Source # (>=) :: BuiltinSemanticsVariant DefaultFun -> BuiltinSemanticsVariant DefaultFun -> Bool Source # max :: BuiltinSemanticsVariant DefaultFun -> BuiltinSemanticsVariant DefaultFun -> BuiltinSemanticsVariant DefaultFun Source # min :: BuiltinSemanticsVariant DefaultFun -> BuiltinSemanticsVariant DefaultFun -> BuiltinSemanticsVariant DefaultFun Source # | |||||
| Ord (BuiltinSemanticsVariant ExtensionFun) Source # | |||||
Defined in PlutusCore.Examples.Builtins Methods compare :: BuiltinSemanticsVariant ExtensionFun -> BuiltinSemanticsVariant ExtensionFun -> Ordering Source # (<) :: BuiltinSemanticsVariant ExtensionFun -> BuiltinSemanticsVariant ExtensionFun -> Bool Source # (<=) :: BuiltinSemanticsVariant ExtensionFun -> BuiltinSemanticsVariant ExtensionFun -> Bool Source # (>) :: BuiltinSemanticsVariant ExtensionFun -> BuiltinSemanticsVariant ExtensionFun -> Bool Source # (>=) :: BuiltinSemanticsVariant ExtensionFun -> BuiltinSemanticsVariant ExtensionFun -> Bool Source # max :: BuiltinSemanticsVariant ExtensionFun -> BuiltinSemanticsVariant ExtensionFun -> BuiltinSemanticsVariant ExtensionFun Source # min :: BuiltinSemanticsVariant ExtensionFun -> BuiltinSemanticsVariant ExtensionFun -> BuiltinSemanticsVariant ExtensionFun Source # | |||||
| NoThunks (BuiltinSemanticsVariant DefaultFun) | |||||
Defined in PlutusCore.Default.Builtins Methods noThunks :: Context -> BuiltinSemanticsVariant DefaultFun -> IO (Maybe ThunkInfo) wNoThunks :: Context -> BuiltinSemanticsVariant DefaultFun -> IO (Maybe ThunkInfo) showTypeOf :: Proxy (BuiltinSemanticsVariant DefaultFun) -> String | |||||
| Pretty (BuiltinSemanticsVariant DefaultFun) Source # | |||||
Defined in PlutusCore.Default.Builtins Methods pretty :: BuiltinSemanticsVariant DefaultFun -> Doc ann # prettyList :: [BuiltinSemanticsVariant DefaultFun] -> Doc ann # | |||||
| data BuiltinSemanticsVariant DefaultFun Source # | |||||
| data BuiltinSemanticsVariant ExtensionFun Source # | |||||
| type Rep (BuiltinSemanticsVariant DefaultFun) Source # | |||||
Defined in PlutusCore.Default.Builtins type Rep (BuiltinSemanticsVariant DefaultFun) = D1 ('MetaData "BuiltinSemanticsVariant" "PlutusCore.Default.Builtins" "plutus-core-1.60.0.0-LXFqBsoUlXsJIEqLytHte7" 'False) ((C1 ('MetaCons "DefaultFunSemanticsVariantA" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DefaultFunSemanticsVariantB" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "DefaultFunSemanticsVariantC" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "DefaultFunSemanticsVariantD" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DefaultFunSemanticsVariantE" 'PrefixI 'False) (U1 :: Type -> Type)))) | |||||
| data BuiltinSemanticsVariant (Either fun1 fun2) Source # | |||||
Defined in PlutusCore.Examples.Builtins data BuiltinSemanticsVariant (Either fun1 fun2) = PairV (BuiltinSemanticsVariant fun1) (BuiltinSemanticsVariant fun2) | |||||
data EvaluationError structural operational Source #
The type of errors that can occur during evaluation. There are two kinds of errors:
- Structural ones -- these are errors that are indicative of the _structure_ of the program being
wrong. For example, a free variable was encountered during evaluation, a non-function was
applied to an argument or
tailListwas applied to a non-list. - Operational ones -- these are errors that are indicative of the _logic_ of the program being
wrong. For example,
errorwas executed,tailListwas applied to an empty list or evaluation ran out of gas.
On the chain both of these are just regular failures and we don't distinguish between them there: if a script fails, it fails, it doesn't matter what the reason was. However in the tests it does matter why the failure occurred: a structural error may indicate that the test was written incorrectly while an operational error may be entirely expected.
In other words, structural errors are "runtime type errors" and operational errors are regular runtime errors. Which means that evaluating an (erased) well-typed program should never produce a structural error, only an operational one. This creates a sort of "runtime type system" for UPLC and it would be great to stick to it and enforce in tests etc, but we currently don't.
Constructors
| StructuralError !structural | |
| OperationalError !operational |
Instances
| Bifoldable EvaluationError Source # | |||||
Defined in PlutusCore.Evaluation.Error Methods bifold :: Monoid m => EvaluationError m m -> m Source # bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> EvaluationError a b -> m Source # bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> EvaluationError a b -> c Source # bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> EvaluationError a b -> c Source # | |||||
| Bifunctor EvaluationError Source # | |||||
Defined in PlutusCore.Evaluation.Error Methods bimap :: (a -> b) -> (c -> d) -> EvaluationError a c -> EvaluationError b d Source # first :: (a -> b) -> EvaluationError a c -> EvaluationError b c Source # second :: (b -> c) -> EvaluationError a b -> EvaluationError a c Source # | |||||
| Bitraversable EvaluationError Source # | |||||
Defined in PlutusCore.Evaluation.Error Methods bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> EvaluationError a b -> f (EvaluationError c d) Source # | |||||
| (HasPrettyDefaults config ~ 'True, PrettyBy config structural, Pretty operational) => PrettyBy config (EvaluationError structural operational) Source # | |||||
Defined in PlutusCore.Evaluation.Error Methods prettyBy :: config -> EvaluationError structural operational -> Doc ann # prettyListBy :: config -> [EvaluationError structural operational] -> Doc ann # | |||||
| Functor (EvaluationError structural) Source # | |||||
Defined in PlutusCore.Evaluation.Error Methods fmap :: (a -> b) -> EvaluationError structural a -> EvaluationError structural b Source # (<$) :: a -> EvaluationError structural b -> EvaluationError structural a Source # | |||||
| Generic (EvaluationError structural operational) Source # | |||||
Defined in PlutusCore.Evaluation.Error Associated Types
Methods from :: EvaluationError structural operational -> Rep (EvaluationError structural operational) x Source # to :: Rep (EvaluationError structural operational) x -> EvaluationError structural operational Source # | |||||
| (Show structural, Show operational) => Show (EvaluationError structural operational) Source # | |||||
Defined in PlutusCore.Evaluation.Error | |||||
| (NFData structural, NFData operational) => NFData (EvaluationError structural operational) Source # | |||||
Defined in PlutusCore.Evaluation.Error Methods rnf :: EvaluationError structural operational -> () Source # | |||||
| (Eq structural, Eq operational) => Eq (EvaluationError structural operational) Source # | |||||
Defined in PlutusCore.Evaluation.Error Methods (==) :: EvaluationError structural operational -> EvaluationError structural operational -> Bool Source # (/=) :: EvaluationError structural operational -> EvaluationError structural operational -> Bool Source # | |||||
| (Pretty structural, Pretty operational) => Pretty (EvaluationError structural operational) Source # | |||||
Defined in PlutusCore.Evaluation.Error Methods pretty :: EvaluationError structural operational -> Doc ann # prettyList :: [EvaluationError structural operational] -> Doc ann # | |||||
| ThrowableBuiltins uni fun => MonadError (CekEvaluationException NamedDeBruijn uni fun) (CekM uni fun s) Source # | |||||
Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal Methods throwError :: CekEvaluationException NamedDeBruijn uni fun -> CekM uni fun s a Source # catchError :: CekM uni fun s a -> (CekEvaluationException NamedDeBruijn uni fun -> CekM uni fun s a) -> CekM uni fun s a Source # | |||||
| type Rep (EvaluationError structural operational) Source # | |||||
Defined in PlutusCore.Evaluation.Error type Rep (EvaluationError structural operational) = D1 ('MetaData "EvaluationError" "PlutusCore.Evaluation.Error" "plutus-core-1.60.0.0-LXFqBsoUlXsJIEqLytHte7" 'False) (C1 ('MetaCons "StructuralError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 structural)) :+: C1 ('MetaCons "OperationalError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 operational))) | |||||
newtype UnliftingError Source #
The error message part of an UnliftingEvaluationError.
Constructors
| MkUnliftingError | |
Fields | |
Instances
| IsString UnliftingError Source # | |
Defined in PlutusCore.Builtin.Result Methods fromString :: String -> UnliftingError Source # | |
| Monoid UnliftingError Source # | |
Defined in PlutusCore.Builtin.Result Methods mempty :: UnliftingError Source # mappend :: UnliftingError -> UnliftingError -> UnliftingError Source # mconcat :: [UnliftingError] -> UnliftingError Source # | |
| Semigroup UnliftingError Source # | |
Defined in PlutusCore.Builtin.Result Methods (<>) :: UnliftingError -> UnliftingError -> UnliftingError Source # sconcat :: NonEmpty UnliftingError -> UnliftingError Source # stimes :: Integral b => b -> UnliftingError -> UnliftingError Source # | |
| Show UnliftingError Source # | |
Defined in PlutusCore.Builtin.Result | |
| NFData UnliftingError Source # | |
Defined in PlutusCore.Builtin.Result Methods rnf :: UnliftingError -> () Source # | |
| Eq UnliftingError Source # | |
Defined in PlutusCore.Builtin.Result Methods (==) :: UnliftingError -> UnliftingError -> Bool Source # (/=) :: UnliftingError -> UnliftingError -> Bool Source # | |
| Pretty UnliftingError Source # | |
Defined in PlutusCore.Builtin.Result | |
data BuiltinError Source #
The type of errors that readKnown and makeKnown can return.
Instances
| Show BuiltinError Source # | |
Defined in PlutusCore.Builtin.Result | |
| Eq BuiltinError Source # | |
Defined in PlutusCore.Builtin.Result Methods (==) :: BuiltinError -> BuiltinError -> Bool Source # (/=) :: BuiltinError -> BuiltinError -> Bool Source # | |
| Pretty BuiltinError Source # | |
Defined in PlutusCore.Builtin.Result | |
| MonadError BuiltinError BuiltinResult Source # |
|
Defined in PlutusCore.Builtin.Result Methods throwError :: BuiltinError -> BuiltinResult a Source # catchError :: BuiltinResult a -> (BuiltinError -> BuiltinResult a) -> BuiltinResult a Source # | |
mkTyBuiltin :: forall a (x :: a) (uni :: Type -> Type) ann tyname. HasTypeLevel uni x => ann -> Type tyname uni ann Source #
Convert a Haskell representation of a possibly 0-ary application of a built-in type to
arbitrary types implementing KnownTypeAst.
class ToKind (uni :: Type -> Type) where Source #
For computing the Plutus kind of a built-in type. See kindOfBuiltinType.
Methods
toSingKind :: forall k (a :: k). uni (Esc a) -> SingKind k Source #
Reify the kind of a type from the universe at the term level.
Instances
| ToKind DefaultUni Source # | |
Defined in PlutusCore.Default.Universe Methods toSingKind :: forall k (a :: k). DefaultUni (Esc a) -> SingKind k Source # | |
data BuiltinsRuntime fun val Source #
A data wrapper around a function returning the BuiltinRuntime of a built-in function.
In order for lookups to be efficient the BuiltinRuntimes need to be cached, i.e. pulled out
of the function statically. See makeBuiltinMeaning for how we achieve that.
Constructors
| BuiltinsRuntime | |
Fields
| |
Instances
| (Bounded fun, Enum fun) => NFData (BuiltinsRuntime fun val) Source # | |
Defined in PlutusCore.Builtin.Runtime Methods rnf :: BuiltinsRuntime fun val -> () Source # | |
| (Bounded fun, Enum fun) => NoThunks (BuiltinsRuntime fun val) Source # | |
Defined in PlutusCore.Builtin.Runtime Methods noThunks :: Context -> BuiltinsRuntime fun val -> IO (Maybe ThunkInfo) wNoThunks :: Context -> BuiltinsRuntime fun val -> IO (Maybe ThunkInfo) showTypeOf :: Proxy (BuiltinsRuntime fun val) -> String | |
class CaseBuiltin (uni :: Type -> Type) where Source #
Methods
caseBuiltin :: UniOf term ~ uni => Some (ValueOf uni) -> Vector term -> HeadSpine Text term (Some (ValueOf uni)) Source #
Given a constant with its type tag and a vector of branches, choose the appropriate branch or fail if the constant doesn't correspond to any of the branches (or casing on constants of this type isn't supported at all).
Instances
| CaseBuiltin DefaultUni Source # | |
Defined in PlutusCore.Default.Universe Methods caseBuiltin :: UniOf term ~ DefaultUni => Some (ValueOf DefaultUni) -> Vector term -> HeadSpine Text term (Some (ValueOf DefaultUni)) Source # | |
data HeadSpine err a b Source #
The head-spine form of an iterated application. Provides O(1) access to the head of the
application. NonEmpty a ~ HeadSpine a a, except is strict and the no-spine case is made a separate
constructor for performance reasons (it only takes a single pattern match to access the head when
there's no spine this way, while otherwise we'd also need to match on the spine to ensure that
it's empty -- and the no-spine case is by far the most common one, hence we want to optimize it).
Used in built-in functions returning function applications such as CaseList.
Instances
| (PrettyBy config err, PrettyBy config a, PrettyBy config (Spine b)) => DefaultPrettyBy config (HeadSpine err a b) Source # | |
Defined in PlutusCore.Builtin.KnownType Methods defaultPrettyBy :: config -> HeadSpine err a b -> Doc ann defaultPrettyListBy :: config -> [HeadSpine err a b] -> Doc ann | |
| PrettyDefaultBy config (HeadSpine err a b) => PrettyBy config (HeadSpine err a b) Source # | |
Defined in PlutusCore.Builtin.KnownType | |
| Bifunctor (HeadSpine err) Source # | |
| Functor (HeadSpine err a) Source # | |
| (Show a, Show b, Show err) => Show (HeadSpine err a b) Source # | |
| (Eq a, Eq b, Eq err) => Eq (HeadSpine err a b) Source # | |
| (Pretty err, Pretty a, Pretty b) => Pretty (HeadSpine err a b) Source # |
|
Defined in PlutusCore.Builtin.KnownType | |
type HasConstantIn (uni :: Type -> Type) term = (UniOf term ~ uni, HasConstant term) Source #
Ensures that term has a Constant-like constructor to lift values to and unlift values from
and connects term and its uni.
fromValueOf :: forall a term. HasConstant term => UniOf term (Esc a) -> a -> term Source #
Wrap a Haskell value (given its explicit type tag) as a term.
fromValue :: forall a term. (HasConstant term, HasTermLevel (UniOf term) a) => a -> term Source #
Wrap a Haskell value (provided its type is in the universe) as a term.
class GEqL (f :: Type -> Type) a where Source #
A version of GEq that fixes a in place, which allows us to create an inlinable recursive
implementation of geqL.
The way it works is that whenever there's recursion, we look up the recursive case in the current
context (i.e. the dictionary) instead of actually calling geqL recursively (even though it's
gonna look like we do exactly that, because there's no way to distinguish between a recursive
call and a dictionary lookup as the two share the same name, although to help GHC choose a lookup
we sprinkle the perhaps unreliable LoopBreaker in the DefaultUni instance of this class).
Alligning things this way allows us to inline arbitrarily deep recursion for as long as types keep being monomorphic.
For example, the MapData builtin accepts a [(Data, Data)] and with geqL matching on all of
DefaultUniProtoList, DefaultUniProtoPair and DefaultUniData gets inlined in the denotation
of the builtin. For the Constr builtin that resulted in a 4.3% speedup at the time this comment
was written.
Instances
| AllBuiltinArgs DefaultUni (GEqL DefaultUni) a => GEqL DefaultUni a Source # | |
Defined in PlutusCore.Default.Universe Methods geqL :: DefaultUni (Esc a) -> DefaultUni (Esc b) -> EvaluationResult (a :~: b) Source # | |
| GEqL uni a => GEqL (LoopBreaker uni) a Source # | |
Defined in PlutusCore.Builtin.KnownType Methods geqL :: LoopBreaker uni (Esc a) -> LoopBreaker uni (Esc b) -> EvaluationResult (a :~: b) Source # | |
newtype LoopBreaker (uni :: Type -> Type) a Source #
In f = ... f ... where f is a class method, how do you know if f is going to be a
recursive call or a type class method call? If both type check, then you don't really know how
GHC is going to play it. So we add this data type to make sure that the RHS f will have to
become a type class method call.
Can GHC turn that method call into a recursive one once type classes are resolved? Dunno, but at least we've introduced an obstacle preventing GHC from immediately creating a non-inlinable recursive definition.
Constructors
| LoopBreaker (uni a) |
Instances
| GEqL uni a => GEqL (LoopBreaker uni) a Source # | |
Defined in PlutusCore.Builtin.KnownType Methods geqL :: LoopBreaker uni (Esc a) -> LoopBreaker uni (Esc b) -> EvaluationResult (a :~: b) Source # | |
type KnownBuiltinTypeIn (uni :: Type -> Type) val a = (HasConstantIn uni val, PrettyParens (SomeTypeIn uni), GEqL uni a, HasTermLevel uni a) Source #
A constraint for "a is a ReadKnownIn and MakeKnownIn by means of being included
in uni".
type KnownBuiltinType val a = KnownBuiltinTypeIn (UniOf val) val a Source #
A constraint for "a is a ReadKnownIn and MakeKnownIn by means of being included
in UniOf term".
type ReadKnownM = Either BuiltinError Source #
The monad that readKnown runs in.
A non-empty spine. Isomorphic to NonEmpty, except is strict and is defined as a single
recursive data type.
Instances
| Foldable Spine Source # | |
Defined in PlutusCore.Builtin.KnownType Methods fold :: Monoid m => Spine m -> m Source # foldMap :: Monoid m => (a -> m) -> Spine a -> m Source # foldMap' :: Monoid m => (a -> m) -> Spine a -> m Source # foldr :: (a -> b -> b) -> b -> Spine a -> b Source # foldr' :: (a -> b -> b) -> b -> Spine a -> b Source # foldl :: (b -> a -> b) -> b -> Spine a -> b Source # foldl' :: (b -> a -> b) -> b -> Spine a -> b Source # foldr1 :: (a -> a -> a) -> Spine a -> a Source # foldl1 :: (a -> a -> a) -> Spine a -> a Source # toList :: Spine a -> [a] Source # null :: Spine a -> Bool Source # length :: Spine a -> Int Source # elem :: Eq a => a -> Spine a -> Bool Source # maximum :: Ord a => Spine a -> a Source # minimum :: Ord a => Spine a -> a Source # | |
| Functor Spine Source # | |
| PrettyBy config a => DefaultPrettyBy config (Spine a) Source # | |
Defined in PlutusCore.Builtin.KnownType Methods defaultPrettyBy :: config -> Spine a -> Doc ann defaultPrettyListBy :: config -> [Spine a] -> Doc ann | |
| PrettyDefaultBy config (Spine a) => PrettyBy config (Spine a) Source # | |
Defined in PlutusCore.Builtin.KnownType | |
| Show a => Show (Spine a) Source # | |
| Eq a => Eq (Spine a) Source # | |
| Pretty a => Pretty (Spine a) Source # |
|
Defined in PlutusCore.Builtin.KnownType | |
type MonoHeadSpine err a = HeadSpine err a a Source #
HeadSpine but the type of head and spine is same
class uni ~ UniOf val => MakeKnownIn (uni :: Type -> Type) val a where Source #
Minimal complete definition
Nothing
Methods
makeKnown :: a -> BuiltinResult val Source #
Convert a Haskell value to the corresponding PLC value.
The inverse of readKnown.
default makeKnown :: KnownBuiltinType val a => a -> BuiltinResult val Source #
Instances
| UniOf term ~ DefaultUni => MakeKnownIn DefaultUni term Void Source # | |
Defined in PlutusCore.Examples.Builtins Methods makeKnown :: Void -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term Int16 Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: Int16 -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term Int32 Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: Int32 -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term Int64 Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: Int64 -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term Int8 Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: Int8 -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term Word16 Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: Word16 -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term Word32 Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: Word32 -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term Word64 Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: Word64 -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term Word8 Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: Word8 -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term ByteString => MakeKnownIn DefaultUni term ByteString Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: ByteString -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term Element => MakeKnownIn DefaultUni term Element Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: Element -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term Element => MakeKnownIn DefaultUni term Element Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: Element -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term MlResult => MakeKnownIn DefaultUni term MlResult Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: MlResult -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term Data => MakeKnownIn DefaultUni term Data Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: Data -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term Value => MakeKnownIn DefaultUni term DataNodeCount Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: DataNodeCount -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term IntegerCostedLiterally Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: IntegerCostedLiterally -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term NumBytesCostedAsNumWords Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: NumBytesCostedAsNumWords -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term Value => MakeKnownIn DefaultUni term ValueMaxDepth Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: ValueMaxDepth -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term Value => MakeKnownIn DefaultUni term ValueTotalSize Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: ValueTotalSize -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term Value => MakeKnownIn DefaultUni term Value Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: Value -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term Text => MakeKnownIn DefaultUni term Text Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: Text -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term Integer Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: Integer -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term Natural Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: Natural -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term () => MakeKnownIn DefaultUni term () Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: () -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term Bool => MakeKnownIn DefaultUni term Bool Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: Bool -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term Int Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: Int -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term Word Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: Word -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term (Vector a) => MakeKnownIn DefaultUni term (Vector a) Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: Vector a -> BuiltinResult term Source # | |
| KnownBuiltinTypeIn DefaultUni term [a] => MakeKnownIn DefaultUni term [a] Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: [a] -> BuiltinResult term Source # | |
| MakeKnownIn uni val a => MakeKnownIn uni val (BuiltinResult a) Source # | |
Defined in PlutusCore.Builtin.KnownType Methods makeKnown :: BuiltinResult a -> BuiltinResult val Source # | |
| (TypeError ('Text "Use \8216BuiltinResult\8217 instead of \8216EvaluationResult\8217") :: Constraint, uni ~ UniOf val) => MakeKnownIn uni val (EvaluationResult a) Source # | |
Defined in PlutusCore.Builtin.KnownType Methods makeKnown :: EvaluationResult a -> BuiltinResult val Source # | |
| KnownBuiltinTypeIn DefaultUni term (a, b) => MakeKnownIn DefaultUni term (a, b) Source # | |
Defined in PlutusCore.Default.Universe Methods makeKnown :: (a, b) -> BuiltinResult term Source # | |
| uni ~ UniOf val => MakeKnownIn uni val (Opaque val rep) Source # | |
Defined in PlutusCore.Builtin.KnownType Methods makeKnown :: Opaque val rep -> BuiltinResult val Source # | |
| HasConstantIn uni val => MakeKnownIn uni val (SomeConstant uni rep) Source # | |
Defined in PlutusCore.Builtin.KnownType Methods makeKnown :: SomeConstant uni rep -> BuiltinResult val Source # | |
| MakeKnownIn DefaultUni term a => MakeKnownIn DefaultUni term (MetaForall name a) Source # | |
Defined in PlutusCore.Examples.Builtins Methods makeKnown :: MetaForall name a -> BuiltinResult term Source # | |
readKnownConstant :: KnownBuiltinType val a => val -> ReadKnownM a Source #
Convert a constant embedded into a PLC term to the corresponding Haskell value.
type MakeKnown val = MakeKnownIn (UniOf val) val Source #
class uni ~ UniOf val => ReadKnownIn (uni :: Type -> Type) val a where Source #
Minimal complete definition
Nothing
Methods
readKnown :: val -> ReadKnownM a Source #
Convert a PLC value to the corresponding Haskell value.
The inverse of makeKnown.
default readKnown :: KnownBuiltinType val a => val -> ReadKnownM a Source #
Instances
| UniOf term ~ DefaultUni => ReadKnownIn DefaultUni term Void Source # | |
Defined in PlutusCore.Examples.Builtins Methods readKnown :: term -> ReadKnownM Void Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term Int16 Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM Int16 Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term Int32 Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM Int32 Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term Int64 Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM Int64 Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term Int8 Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM Int8 Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term Word16 Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM Word16 Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term Word32 Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM Word32 Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term Word64 Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM Word64 Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term Word8 Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM Word8 Source # | |
| KnownBuiltinTypeIn DefaultUni term ByteString => ReadKnownIn DefaultUni term ByteString Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM ByteString Source # | |
| KnownBuiltinTypeIn DefaultUni term Element => ReadKnownIn DefaultUni term Element Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM Element Source # | |
| KnownBuiltinTypeIn DefaultUni term Element => ReadKnownIn DefaultUni term Element Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM Element Source # | |
| KnownBuiltinTypeIn DefaultUni term MlResult => ReadKnownIn DefaultUni term MlResult Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM MlResult Source # | |
| KnownBuiltinTypeIn DefaultUni term Data => ReadKnownIn DefaultUni term Data Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM Data Source # | |
| KnownBuiltinTypeIn DefaultUni term Value => ReadKnownIn DefaultUni term DataNodeCount Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM DataNodeCount Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term IntegerCostedLiterally Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM IntegerCostedLiterally Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term NumBytesCostedAsNumWords Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM NumBytesCostedAsNumWords Source # | |
| KnownBuiltinTypeIn DefaultUni term Value => ReadKnownIn DefaultUni term ValueMaxDepth Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM ValueMaxDepth Source # | |
| KnownBuiltinTypeIn DefaultUni term Value => ReadKnownIn DefaultUni term ValueTotalSize Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM ValueTotalSize Source # | |
| KnownBuiltinTypeIn DefaultUni term Value => ReadKnownIn DefaultUni term Value Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM Value Source # | |
| KnownBuiltinTypeIn DefaultUni term Text => ReadKnownIn DefaultUni term Text Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM Text Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term Integer Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM Integer Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term Natural Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM Natural Source # | |
| KnownBuiltinTypeIn DefaultUni term () => ReadKnownIn DefaultUni term () Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM () Source # | |
| KnownBuiltinTypeIn DefaultUni term Bool => ReadKnownIn DefaultUni term Bool Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM Bool Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term Int Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM Int Source # | |
| KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term Word Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM Word Source # | |
| KnownBuiltinTypeIn DefaultUni term (Vector a) => ReadKnownIn DefaultUni term (Vector a) Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM (Vector a) Source # | |
| KnownBuiltinTypeIn DefaultUni term [a] => ReadKnownIn DefaultUni term [a] Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM [a] Source # | |
| (TypeError ('Text "\8216BuiltinResult\8217 cannot appear in the type of an argument") :: Constraint, uni ~ UniOf val) => ReadKnownIn uni val (BuiltinResult a) Source # | |
Defined in PlutusCore.Builtin.KnownType Methods readKnown :: val -> ReadKnownM (BuiltinResult a) Source # | |
| (TypeError ('Text "Use \8216BuiltinResult\8217 instead of \8216EvaluationResult\8217") :: Constraint, uni ~ UniOf val) => ReadKnownIn uni val (EvaluationResult a) Source # | |
Defined in PlutusCore.Builtin.KnownType Methods readKnown :: val -> ReadKnownM (EvaluationResult a) Source # | |
| KnownBuiltinTypeIn DefaultUni term (a, b) => ReadKnownIn DefaultUni term (a, b) Source # | |
Defined in PlutusCore.Default.Universe Methods readKnown :: term -> ReadKnownM (a, b) Source # | |
| uni ~ UniOf val => ReadKnownIn uni val (Opaque val rep) Source # | |
Defined in PlutusCore.Builtin.KnownType Methods readKnown :: val -> ReadKnownM (Opaque val rep) Source # | |
| HasConstantIn uni val => ReadKnownIn uni val (SomeConstant uni rep) Source # | |
Defined in PlutusCore.Builtin.KnownType Methods readKnown :: val -> ReadKnownM (SomeConstant uni rep) Source # | |
type ReadKnown val = ReadKnownIn (UniOf val) val Source #
makeKnownOrFail :: forall (uni :: Type -> Type) val a. MakeKnownIn uni val a => a -> EvaluationResult val Source #
Same as makeKnown, but allows for neither emitting nor storing the cause of a failure.
readKnownSelf :: (ReadKnown val a, BuiltinErrorToEvaluationError structural operational) => val -> Either (ErrorWithCause (EvaluationError structural operational) val) a Source #
Same as readKnown, but the cause of a potential failure is the provided term itself.
Representation of a type variable: its name and unique and an implicit kind.
Instances
| (name ~ ('TyNameRep text uniq :: TyNameRep kind), KnownSymbol text, KnownNat uniq, KnownKind kind, KnownTypeAst tyname uni a) => KnownTypeAst tyname uni (MetaForall name a :: Type) Source # | |||||
Defined in PlutusCore.Examples.Builtins Associated Types
| |||||
| 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. | ||||
Defined in PlutusCore.Builtin.Meaning Methods knownPolytype :: TypeScheme val args res Source # toPolyF :: ReadKnownM (FoldArgs args res, FoldArgs args ExBudgetStream) -> BuiltinRuntime val Source # | |||||
| (TypeError NoStandalonePolymorphicDataErrMsg :: Constraint) => Contains uni (TyVarRep :: TyNameRep kind -> kind) 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 | ||||
Defined in PlutusCore.Builtin.Meaning Methods knownPolytype :: TypeScheme val args res Source # toPolyF :: ReadKnownM (FoldArgs args res, FoldArgs args ExBudgetStream) -> BuiltinRuntime val Source # | |||||
| type ToBinds uni acc (MetaForall name a :: Type) Source # | |||||
Defined in PlutusCore.Examples.Builtins | |||||
| type ToHoles uni _1 (MetaForall name a :: Type) Source # | |||||
Defined in PlutusCore.Examples.Builtins | |||||
| type IsBuiltin uni (MetaForall name a :: Type) Source # | |||||
Defined in PlutusCore.Examples.Builtins | |||||
data family TyVarRep (name :: TyNameRep kind) :: kind Source #
Representation of an intrinsically-kinded type variable: a name.
Instances
| (tyname ~ TyName, name ~ ('TyNameRep text uniq :: TyNameRep a), KnownSymbol text, KnownNat uniq) => KnownTypeAst tyname uni (TyVarRep name :: a) Source # | |
| (TypeError NoStandalonePolymorphicDataErrMsg :: Constraint) => Contains uni (TyVarRep :: TyNameRep kind -> kind) Source # | |
| type ToBinds uni acc (TyVarRep name :: a) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type ToHoles uni _1 (TyVarRep name :: a) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type IsBuiltin uni (TyVarRep name :: a) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
data family TyAppRep (fun :: dom -> cod) (arg :: dom) :: cod Source #
Representation of an intrinsically-kinded type application: a function and an argument.
Instances
| (KnownTypeAst tyname uni fun, KnownTypeAst tyname uni arg) => KnownTypeAst tyname uni (TyAppRep fun arg :: a) Source # | |
| type ToBinds uni acc (TyAppRep fun arg :: a) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type ToHoles uni _1 (TyAppRep fun arg :: a) Source # | |
| type IsBuiltin uni (TyAppRep fun arg :: a) Source # | |
data family TyForallRep (name :: TyNameRep kind) a Source #
Representation of of an intrinsically-kinded universal quantifier: a bound name and a body.
Instances
| (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 # | |||||
Defined in PlutusCore.Builtin.KnownTypeAst Associated Types
| |||||
| type ToBinds uni acc (TyForallRep name a :: Type) Source # | |||||
Defined in PlutusCore.Builtin.KnownTypeAst | |||||
| type ToHoles uni _1 (TyForallRep name a :: Type) Source # | |||||
Defined in PlutusCore.Builtin.KnownTypeAst | |||||
| type IsBuiltin uni (TyForallRep name a :: Type) Source # | |||||
Defined in PlutusCore.Builtin.KnownTypeAst | |||||
type family RunHole (hole :: Type -> Type) :: a -> Hole where ... Source #
Turn a hole in the GHC.Type -> GHC.Type form into one of the Hole form. This only changes
the kind of the given argument. This is a way of encoding forall a. a -> Hole at the kind
level, which we don't attempt to use, because GHC apparently hates polymorphism at the kind
level and chokes upon encountering it.
type KnownBuiltinTypeAst tyname (uni :: Type -> Type) (x :: a) = AllBuiltinArgs uni (KnownTypeAst tyname uni :: Type -> Constraint) x Source #
A constraint for "a is a KnownTypeAst by means of being included in uni".
toTypeAst :: forall a tyname (uni :: Type -> Type) (x :: a) proxy. KnownTypeAst tyname uni x => proxy x -> Type tyname uni () Source #
Return the Plutus counterpart of the x type.
type family Insert (x :: a) (xs :: [a]) :: [a] where ... Source #
Insert x into xs unless it's already there.
type family Delete (x :: a) (xs :: [a]) :: [a] where ... Source #
Delete the first x from a list. Which is okay since we only ever put things in once.
type family FoldArgs (args :: [Type]) res where ... Source #
Turn a list of Haskell types args into a functional type ending in res.
>>>:set -XDataKinds>>>:kind! FoldArgs [(), Bool] IntegerFoldArgs [(), Bool] Integer :: * = () -> Bool -> Integer
newtype SomeConstant (uni :: Type -> Type) rep 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
| KnownTypeAst tyname uni rep => KnownTypeAst tyname uni (SomeConstant uni rep :: Type) Source # | |||||
Defined in PlutusCore.Builtin.KnownTypeAst Associated Types
| |||||
| HasConstantIn uni val => MakeKnownIn uni val (SomeConstant uni rep) Source # | |||||
Defined in PlutusCore.Builtin.KnownType Methods makeKnown :: SomeConstant uni rep -> BuiltinResult val Source # | |||||
| HasConstantIn uni val => ReadKnownIn uni val (SomeConstant uni rep) Source # | |||||
Defined in PlutusCore.Builtin.KnownType Methods readKnown :: val -> ReadKnownM (SomeConstant uni rep) Source # | |||||
| HasConstant (SomeConstant uni rep) Source # | |||||
Defined in PlutusCore.Builtin.Polymorphism Methods asConstant :: SomeConstant uni rep -> Either BuiltinError (Some (ValueOf (UniOf (SomeConstant uni rep)))) Source # fromConstant :: Some (ValueOf (UniOf (SomeConstant uni rep))) -> SomeConstant uni rep Source # | |||||
| (Everywhere uni ExMemoryUsage, Closed uni) => ExMemoryUsage (SomeConstant uni rep) Source # | |||||
Defined in PlutusCore.Builtin.Polymorphism Methods memoryUsage :: SomeConstant uni rep -> CostRose Source # | |||||
| type ToBinds uni acc (SomeConstant uni rep :: Type) Source # | |||||
Defined in PlutusCore.Builtin.KnownTypeAst | |||||
| type ToHoles uni _1 (SomeConstant uni rep :: Type) Source # | |||||
Defined in PlutusCore.Builtin.KnownTypeAst | |||||
| type IsBuiltin uni (SomeConstant uni rep :: Type) Source # | |||||
Defined in PlutusCore.Builtin.KnownTypeAst | |||||
| type UniOf (SomeConstant uni rep) Source # | |||||
Defined in PlutusCore.Builtin.Polymorphism | |||||
data family BuiltinHead (x :: a) :: a Source #
For annotating an uninstantiated built-in type, so that it gets handled by the right instance or type family.
Instances
| Contains uni f => KnownTypeAst tyname uni (BuiltinHead f :: a) Source # | |||||
Defined in PlutusCore.Builtin.KnownTypeAst Associated Types
| |||||
| type ToBinds uni acc (BuiltinHead f :: a) Source # | |||||
Defined in PlutusCore.Builtin.KnownTypeAst | |||||
| type ToHoles uni _1 (BuiltinHead f :: a) Source # | |||||
Defined in PlutusCore.Builtin.KnownTypeAst | |||||
| type IsBuiltin uni (BuiltinHead f :: a) Source # | |||||
Defined in PlutusCore.Builtin.KnownTypeAst | |||||
data family LastArg x y Source #
LastArg x y is the same thing as y in the signature of the denotation of a built-in
functions and this type is only used for referencing x before y, so that the elaboration
machinery generates x before y in the all part of the Plutus signature of the builtin.
This is a very hacky and indirect way of specifying the ordering of type variables in a Plutus
signature, in future we'll do it explicitly by introducing a Forall binder for use in type
signatures of denotations of builtins.
type family ElaborateBuiltin (uni :: Type -> Type) (x :: a) :: a 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
| type ElaborateBuiltin DefaultUni (x :: a) Source # | |
Defined in PlutusCore.Default.Universe | |
type family AllElaboratedArgs (constr :: Type -> Constraint) (x :: a) 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 (TyAppRep f x :: a) = (constr x, AllElaboratedArgs constr f) | |
| AllElaboratedArgs _1 (BuiltinHead _2 :: a) = () |
class AllElaboratedArgs constr (ElaborateBuiltin uni x) => AllBuiltinArgs (uni :: Type -> Type) (constr :: Type -> Constraint) (x :: a) Source #
Take a constraint and use it to constrain every argument of a possibly 0-ary application of a built-in type.
Instances
| AllElaboratedArgs constr (ElaborateBuiltin uni x) => AllBuiltinArgs uni constr (x :: a) Source # | |
Defined in PlutusCore.Builtin.Polymorphism | |
newtype UnliftingEvaluationError Source #
When unlifting of a PLC term into a Haskell value fails, this error is thrown.
Constructors
| MkUnliftingEvaluationError | |
Instances
| Show UnliftingEvaluationError Source # | |
Defined in PlutusCore.Builtin.Result | |
| NFData UnliftingEvaluationError Source # | |
Defined in PlutusCore.Builtin.Result Methods rnf :: UnliftingEvaluationError -> () Source # | |
| Eq UnliftingEvaluationError Source # | |
Defined in PlutusCore.Builtin.Result Methods (==) :: UnliftingEvaluationError -> UnliftingEvaluationError -> Bool Source # (/=) :: UnliftingEvaluationError -> UnliftingEvaluationError -> Bool Source # | |
| Pretty UnliftingEvaluationError Source # | |
Defined in PlutusCore.Builtin.Result Methods pretty :: UnliftingEvaluationError -> Doc ann # prettyList :: [UnliftingEvaluationError] -> Doc ann # | |
operationalUnliftingError :: Text -> BuiltinError Source #
Construct a prism focusing on the *EvaluationFailure part of err by taking
that *EvaluationFailure and
- pretty-printing and embedding it into an
UnliftingErrorfor the setter part of the prism - returning it directly for the opposite direction (there's no other way to convert an
UnliftingErrorto an evaluation failure, since the latter doesn't carry any content)
This is useful for providing AsUnliftingError instances for types such as CkUserError and
CekUserError.
withLogs :: DList Text -> BuiltinResult a -> BuiltinResult a Source #
Prepend logs to a BuiltinResult computation.
throwing :: MonadError e m => AReview e t -> t -> m x #
throwing_ :: MonadError e m => AReview e () -> m x #
data BuiltinRuntime val Source #
A BuiltinRuntime represents a possibly partial builtin application, including an empty
builtin application (i.e. just the builtin with no arguments).
Applying or type-instantiating a builtin peels off the corresponding constructor from its
BuiltinRuntime.
BuiltinCostedResult contains the cost (an ExBudgetStream) and the result (a
BuiltinResult (HeadSpine val)) of the builtin application. The cost is stored strictly, since
the evaluator is going to look at it and the result is stored lazily, since it's not supposed to
be forced before accounting for the cost of the application. If the cost exceeds the available
budget, the evaluator discards the result of the builtin application without ever forcing it and
terminates with evaluation failure. Allowing the user to compute something that they don't have
the budget for would be a major bug.
Evaluators that ignore the entire concept of costing (e.g. the CK machine) may of course force the result of the builtin application unconditionally.
Constructors
| BuiltinCostedResult ExBudgetStream ~(BuiltinResult val) | |
| BuiltinExpectArgument (val -> BuiltinRuntime val) | |
| BuiltinExpectForce (BuiltinRuntime val) |
Instances
| Show (BuiltinRuntime (CkValue uni fun)) Source # | |
Defined in PlutusCore.Evaluation.Machine.Ck | |
| Show (BuiltinRuntime (CekValue uni fun ann)) Source # | |
| NFData (BuiltinRuntime val) Source # | |
Defined in PlutusCore.Builtin.Runtime Methods rnf :: BuiltinRuntime val -> () Source # | |
| NoThunks (BuiltinRuntime val) Source # | |
Defined in PlutusCore.Builtin.Runtime Methods noThunks :: Context -> BuiltinRuntime val -> IO (Maybe ThunkInfo) wNoThunks :: Context -> BuiltinRuntime val -> IO (Maybe ThunkInfo) showTypeOf :: Proxy (BuiltinRuntime val) -> String | |
class (Everywhere uni (ImplementedKnownTypeAst uni), Everywhere uni (ImplementedReadKnownIn uni), Everywhere uni (ImplementedMakeKnownIn uni)) => TestTypesFromTheUniverseAreAllKnown (uni :: Type -> Type) Source #
An instance of this class not having any constraints ensures that every type (according to
Everywhere) from the universe has 'KnownTypeAst, ReadKnownIn and MakeKnownIn instances.
Instances
argProxy :: forall val arg (args :: [Type]) res. TypeScheme val (arg ': args) res -> Proxy arg Source #
typeSchemeToType :: forall val (args :: [Type]) res. TypeScheme val args res -> Type TyName (UniOf val) () Source #
Convert a TypeScheme to the corresponding Type.
withSingKind :: Kind ann -> (forall k. SingKind k -> r) -> r Source #
bringKnownKind :: SingKind k -> (KnownKind k => r) -> r Source #
demoteKind :: SingKind k -> Kind () Source #
Convert a reified Haskell kind to a Plutus kind.
kindOfBuiltinType :: forall {k} uni (a :: k). ToKind uni => uni (Esc a) -> Kind () Source #
Compute the kind of a type from a universe.
type family ToHoles (uni :: Type -> Type) (hole :: Type -> Type) (x :: a) :: [Hole] Source #
Return every part of the type that can be a to-be-instantiated type variable.
For example, in Integer there's no such types and in (a, b) it's the two arguments
(a and b) and the same applies to a -> b (to mention a type that is not built-in).
Takes a hole in the GHC.Type -> GHC.Type form (a convention originally adopted in the
elaborator, perhaps not a very helpful one), which can be turned into an actual Hole via
RunHole.
Instances
| type ToHoles DefaultUni _1 Void Source # | |
Defined in PlutusCore.Examples.Builtins | |
| type ToHoles DefaultUni hole Int16 Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToHoles DefaultUni hole Int32 Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToHoles DefaultUni hole Int64 Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToHoles DefaultUni hole Int8 Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToHoles DefaultUni hole Word16 Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToHoles DefaultUni hole Word32 Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToHoles DefaultUni hole Word64 Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToHoles DefaultUni hole Word8 Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToHoles DefaultUni hole ByteString Source # | |
Defined in PlutusCore.Default.Universe type ToHoles DefaultUni hole ByteString = ToHoles DefaultUni hole (ElaborateBuiltin DefaultUni ByteString) | |
| type ToHoles DefaultUni hole Element Source # | |
Defined in PlutusCore.Default.Universe type ToHoles DefaultUni hole Element = ToHoles DefaultUni hole (ElaborateBuiltin DefaultUni Element) | |
| type ToHoles DefaultUni hole Element Source # | |
Defined in PlutusCore.Default.Universe type ToHoles DefaultUni hole Element = ToHoles DefaultUni hole (ElaborateBuiltin DefaultUni Element) | |
| type ToHoles DefaultUni hole MlResult Source # | |
Defined in PlutusCore.Default.Universe type ToHoles DefaultUni hole MlResult = ToHoles DefaultUni hole (ElaborateBuiltin DefaultUni MlResult) | |
| type ToHoles DefaultUni hole Data Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToHoles DefaultUni hole DataNodeCount Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToHoles DefaultUni hole IntegerCostedLiterally Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToHoles DefaultUni hole NumBytesCostedAsNumWords Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToHoles DefaultUni hole ValueMaxDepth Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToHoles DefaultUni hole ValueTotalSize Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToHoles DefaultUni hole Value Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToHoles DefaultUni hole Text Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToHoles DefaultUni hole Integer Source # | |
Defined in PlutusCore.Default.Universe type ToHoles DefaultUni hole Integer = ToHoles DefaultUni hole (ElaborateBuiltin DefaultUni Integer) | |
| type ToHoles DefaultUni hole Natural Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToHoles DefaultUni hole () Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToHoles DefaultUni hole Bool Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToHoles DefaultUni hole Int Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToHoles DefaultUni hole Word Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToHoles DefaultUni hole (Vector a :: Type) Source # | |
Defined in PlutusCore.Default.Universe type ToHoles DefaultUni hole (Vector a :: Type) = ToHoles DefaultUni hole (ElaborateBuiltin DefaultUni (Vector a)) | |
| type ToHoles DefaultUni hole ([a] :: Type) Source # | |
Defined in PlutusCore.Default.Universe type ToHoles DefaultUni hole ([a] :: Type) = ToHoles DefaultUni hole (ElaborateBuiltin DefaultUni [a]) | |
| type ToHoles uni _1 (BuiltinResult a :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type ToHoles uni _1 (EvaluationResult a :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type ToHoles uni _1 (PlcListRep a :: Type) Source # | |
Defined in PlutusCore.Examples.Builtins | |
| type ToHoles DefaultUni hole ((a, b) :: Type) Source # | |
Defined in PlutusCore.Default.Universe type ToHoles DefaultUni hole ((a, b) :: Type) = ToHoles DefaultUni hole (ElaborateBuiltin DefaultUni (a, b)) | |
| type ToHoles uni _1 (Opaque val rep :: Type) Source # | |
| type ToHoles uni _1 (SomeConstant uni rep :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type ToHoles uni hole (LastArg x y :: Type) Source # | |
| type ToHoles uni hole (a -> b :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type ToHoles uni _1 (BuiltinHead f :: a) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type ToHoles uni _1 (TyVarRep name :: a) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type ToHoles uni _1 (TyForallRep name a :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type ToHoles uni _1 (MetaForall name a :: Type) Source # | |
Defined in PlutusCore.Examples.Builtins | |
| type ToHoles uni _1 (TyAppRep fun arg :: a) Source # | |
type family ToBinds (uni :: Type -> Type) (acc :: [Some TyNameRep]) (x :: a) :: [Some TyNameRep] Source #
Collect all unique variables (a variable consists of a textual name, a unique and a kind) in an accumulator and return the accumulator once a leaf is reached.
Instances
| type ToBinds DefaultUni acc Void Source # | |
Defined in PlutusCore.Examples.Builtins | |
| type ToBinds DefaultUni acc Int16 Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToBinds DefaultUni acc Int32 Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToBinds DefaultUni acc Int64 Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToBinds DefaultUni acc Int8 Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToBinds DefaultUni acc Word16 Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToBinds DefaultUni acc Word32 Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToBinds DefaultUni acc Word64 Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToBinds DefaultUni acc Word8 Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToBinds DefaultUni acc ByteString Source # | |
Defined in PlutusCore.Default.Universe type ToBinds DefaultUni acc ByteString = ToBinds DefaultUni acc (ElaborateBuiltin DefaultUni ByteString) | |
| type ToBinds DefaultUni acc Element Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToBinds DefaultUni acc Element Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToBinds DefaultUni acc MlResult Source # | |
Defined in PlutusCore.Default.Universe type ToBinds DefaultUni acc MlResult = ToBinds DefaultUni acc (ElaborateBuiltin DefaultUni MlResult) | |
| type ToBinds DefaultUni acc Data Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToBinds DefaultUni acc DataNodeCount Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToBinds DefaultUni acc IntegerCostedLiterally Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToBinds DefaultUni acc NumBytesCostedAsNumWords Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToBinds DefaultUni acc ValueMaxDepth Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToBinds DefaultUni acc ValueTotalSize Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToBinds DefaultUni acc Value Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToBinds DefaultUni acc Text Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToBinds DefaultUni acc Integer Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToBinds DefaultUni acc Natural Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToBinds DefaultUni acc () Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToBinds DefaultUni acc Bool Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToBinds DefaultUni acc Int Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToBinds DefaultUni acc Word Source # | |
Defined in PlutusCore.Default.Universe | |
| type ToBinds DefaultUni acc (Vector a :: Type) Source # | |
Defined in PlutusCore.Default.Universe type ToBinds DefaultUni acc (Vector a :: Type) = ToBinds DefaultUni acc (ElaborateBuiltin DefaultUni (Vector a)) | |
| type ToBinds DefaultUni acc ([a] :: Type) Source # | |
Defined in PlutusCore.Default.Universe type ToBinds DefaultUni acc ([a] :: Type) = ToBinds DefaultUni acc (ElaborateBuiltin DefaultUni [a]) | |
| type ToBinds uni acc (BuiltinResult a :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type ToBinds uni acc (EvaluationResult a :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type ToBinds uni acc (PlcListRep a :: Type) Source # | |
Defined in PlutusCore.Examples.Builtins | |
| type ToBinds DefaultUni acc ((a, b) :: Type) Source # | |
Defined in PlutusCore.Default.Universe type ToBinds DefaultUni acc ((a, b) :: Type) = ToBinds DefaultUni acc (ElaborateBuiltin DefaultUni (a, b)) | |
| type ToBinds uni acc (LastArg x y :: Type) Source # | |
| type ToBinds uni acc (Opaque val rep :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type ToBinds uni acc (SomeConstant uni rep :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type ToBinds uni acc (a -> b :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type ToBinds uni acc (BuiltinHead f :: a) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type ToBinds uni acc (TyVarRep name :: a) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type ToBinds uni acc (TyForallRep name a :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type ToBinds uni acc (MetaForall name a :: Type) Source # | |
Defined in PlutusCore.Examples.Builtins | |
| type ToBinds uni acc (TyAppRep fun arg :: a) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
type family IsBuiltin (uni :: Type -> Type) (x :: a) :: Bool Source #
Whether x is a built-in type.
Instances
| type IsBuiltin DefaultUni Void Source # | |
Defined in PlutusCore.Examples.Builtins | |
| type IsBuiltin DefaultUni Int16 Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin DefaultUni Int32 Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin DefaultUni Int64 Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin DefaultUni Int8 Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin DefaultUni Word16 Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin DefaultUni Word32 Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin DefaultUni Word64 Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin DefaultUni Word8 Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin DefaultUni ByteString Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin DefaultUni Element Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin DefaultUni Element Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin DefaultUni MlResult Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin DefaultUni Data Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin DefaultUni DataNodeCount Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin DefaultUni IntegerCostedLiterally Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin DefaultUni NumBytesCostedAsNumWords Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin DefaultUni ValueMaxDepth Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin DefaultUni ValueTotalSize Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin DefaultUni Value Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin DefaultUni Text Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin DefaultUni Integer Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin DefaultUni Natural Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin DefaultUni () Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin DefaultUni Bool Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin DefaultUni Int Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin DefaultUni Word Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin DefaultUni (Vector a :: Type) Source # | |
Defined in PlutusCore.Default.Universe type IsBuiltin DefaultUni (Vector a :: Type) = IsBuiltin DefaultUni (ElaborateBuiltin DefaultUni (Vector a)) | |
| type IsBuiltin DefaultUni ([a] :: Type) Source # | |
Defined in PlutusCore.Default.Universe | |
| type IsBuiltin uni (BuiltinResult a :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type IsBuiltin uni (EvaluationResult a :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type IsBuiltin uni (PlcListRep a :: Type) Source # | |
Defined in PlutusCore.Examples.Builtins | |
| type IsBuiltin DefaultUni ((a, b) :: Type) Source # | |
Defined in PlutusCore.Default.Universe type IsBuiltin DefaultUni ((a, b) :: Type) = IsBuiltin DefaultUni (ElaborateBuiltin DefaultUni (a, b)) | |
| type IsBuiltin uni (LastArg x y :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type IsBuiltin uni (Opaque val rep :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type IsBuiltin uni (SomeConstant uni rep :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type IsBuiltin uni (a -> b :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type IsBuiltin uni (BuiltinHead f :: a) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type IsBuiltin uni (TyVarRep name :: a) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type IsBuiltin uni (TyForallRep name a :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
| type IsBuiltin uni (MetaForall name a :: Type) Source # | |
Defined in PlutusCore.Examples.Builtins | |
| type IsBuiltin uni (TyAppRep fun arg :: a) Source # | |
builtinRuntimeFailure :: BuiltinError -> BuiltinRuntime val Source #
lookupBuiltin :: fun -> BuiltinsRuntime fun val -> BuiltinRuntime val Source #
Look up the runtime info of a built-in function during evaluation.
class MakeBuiltinMeaning a val where Source #
A function turned into a type class with exactly one fully general instance.
We can't package up the constraints of makeBuiltinMeaning (see the instance) into a type or
class synonym, because they contain a bunch of variables defined by ~ or determined via
functional dependencies and neither class nor type definitions can handle that
(see https://gitlab.haskell.org/ghc/ghc/-/issues/7100). Inlining three lines of constraints
whenever we need to call makeBuiltinMeaning over a non-concrete type is a bad option and this
abstraction is free anyway, hence its existence.
The a type variable goes first, because makeBuiltinMeaning @A is a common pattern.
Methods
makeBuiltinMeaning :: a -> (cost -> FoldArgs (GetArgs a) ExBudgetStream) -> BuiltinMeaning val cost Source #
Construct the meaning for a built-in function by automatically deriving its
TypeScheme, given
- the denotation of the builtin
- an uninstantiated costing function
Instances
| (uni ~ UniOf val, binds ~ ToBinds uni ('[] :: [Some TyNameRep]) a, args ~ GetArgs a, a ~ FoldArgs args res, ThrowOnBothEmpty binds args (IsBuiltin uni a) a, ElaborateFromTo uni 0 j val a, KnownPolytype binds val args res) => MakeBuiltinMeaning a val Source # | |
Defined in PlutusCore.Builtin.Meaning Methods makeBuiltinMeaning :: a -> (cost -> FoldArgs (GetArgs a) ExBudgetStream) -> BuiltinMeaning val cost Source # | |
data BuiltinMeaning val cost Source #
The meaning of a built-in function consists of its type represented as a TypeScheme,
its Haskell denotation and its uninstantiated runtime denotation.
The TypeScheme of a built-in function is used for example for
- computing the PLC type of the function to be used during type checking
- getting arity information
- generating arbitrary values to apply the function to in tests
The denotation is lazy, so that we don't need to worry about a builtin being bottom (happens in tests). The production path is not affected by that, since only runtime denotations are used for evaluation.
Constructors
| BuiltinMeaning (TypeScheme val args res) ~(FoldArgs args res) (cost -> BuiltinRuntime val) |
type HasMeaningIn (uni :: Type -> Type) val = (Typeable val, ExMemoryUsage val, HasConstantIn uni val) Source #
Constraints available when defining a built-in function.
type family CostingPart (uni :: Type -> Type) fun Source #
The cost part of BuiltinMeaning.
Instances
| type CostingPart uni DefaultFun Source # | |
Defined in PlutusCore.Default.Builtins | |
| type CostingPart uni ExtensionFun Source # | |
Defined in PlutusCore.Examples.Builtins | |
| type CostingPart uni (Either fun1 fun2) Source # | |
Defined in PlutusCore.Examples.Builtins | |
withTypeSchemeOfBuiltinFunction :: (ToBuiltinMeaning (UniOf val) fun, ExMemoryUsage val, Typeable val, HasConstant val) => BuiltinSemanticsVariant fun -> fun -> (forall (args :: [Type]) res. TypeScheme val args res -> r) -> r Source #
Feed the TypeScheme of the given built-in function to the continuation.
typeOfBuiltinFunction :: forall (uni :: Type -> Type) fun. ToBuiltinMeaning uni fun => BuiltinSemanticsVariant fun -> fun -> Type TyName uni () Source #
Get the type of a built-in function.
type family GetArgs a :: [Type] where ... Source #
Chop a function type to get a list of its argument types.
class KnownMonotype val (args :: [Type]) res where Source #
A class that allows us to derive a monotype for a builtin.
We could've computed the runtime denotation from the
TypeScheme and the denotation of the builtin, but not statically (due to unfolding not working
for recursive functions and TypeScheme being recursive, i.e. requiring the conversion function
to be recursive), and so it would cause us to retain a lot of evaluation-irrelevant stuff in the
constructors of BuiltinRuntime, which has to make evaluation slower (we didn't check) and
certainly makes the generated Core much harder to read. Technically speaking, we could get
a RuntimeScheme from the TypeScheme and the denotation statically if we changed the
definition of TypeScheme and made it a singleton, but then the conversion function would have
to become a class anyway and we'd just replicate what we have here, except in a much more
complicated way.
Methods
knownMonotype :: TypeScheme val args res Source #
toMonoF :: ReadKnownM (FoldArgs args res, FoldArgs args ExBudgetStream) -> BuiltinRuntime val Source #
Convert the denotation of a builtin to its runtime counterpart.
The argument is in ReadKnownM, because that's what deferred unlifting amounts to:
passing the action returning the builtin application around until full saturation, which is
when the action actually gets run.
Instances
| (Typeable res, KnownTypeAst TyName (UniOf val) res, MakeKnown val res) => KnownMonotype val ('[] :: [Type]) res Source # | Once we've run out of term-level arguments, we return a
|
Defined in PlutusCore.Builtin.Meaning Methods knownMonotype :: TypeScheme val ('[] :: [Type]) res Source # toMonoF :: ReadKnownM (FoldArgs ('[] :: [Type]) res, FoldArgs ('[] :: [Type]) ExBudgetStream) -> BuiltinRuntime val Source # | |
| (Typeable arg, KnownTypeAst TyName (UniOf val) arg, MakeKnown val arg, ReadKnown val arg, KnownMonotype val args res) => KnownMonotype val (arg ': args) res Source # | Every term-level argument becomes a |
Defined in PlutusCore.Builtin.Meaning Methods knownMonotype :: TypeScheme val (arg ': args) res Source # toMonoF :: ReadKnownM (FoldArgs (arg ': args) res, FoldArgs (arg ': args) ExBudgetStream) -> BuiltinRuntime val Source # | |
class KnownMonotype val args res => KnownPolytype (binds :: [Some TyNameRep]) val (args :: [Type]) res where Source #
A class that allows us to derive a polytype for a builtin.
Methods
knownPolytype :: TypeScheme val args res Source #
toPolyF :: ReadKnownM (FoldArgs args res, FoldArgs args ExBudgetStream) -> BuiltinRuntime val Source #
Convert the denotation of a builtin to its runtime counterpart.
The argument is in ReadKnownM, because that's what we need to do:
passing the action returning the builtin application around until full saturation, which is
when the action actually gets run.
Instances
| 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. |
Defined in PlutusCore.Builtin.Meaning Methods knownPolytype :: TypeScheme val args res Source # toPolyF :: ReadKnownM (FoldArgs args res, FoldArgs args ExBudgetStream) -> BuiltinRuntime val 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 |
Defined in PlutusCore.Builtin.Meaning Methods knownPolytype :: TypeScheme val args res Source # toPolyF :: ReadKnownM (FoldArgs args res, FoldArgs args ExBudgetStream) -> BuiltinRuntime val Source # | |
type family ThrowOnBothEmpty (binds :: [Some TyNameRep]) (args :: [Type]) (isBuiltin :: Bool) a where ... Source #
Ensure a built-in function is not nullary and throw a nice error otherwise.
Equations
| ThrowOnBothEmpty ('[] :: [Some TyNameRep]) ('[] :: [Type]) 'True a = TypeError (('Text "A built-in function must take at least one type or term argument" ':$$: ((('Text "\8216" ':<>: 'ShowType a) ':<>: 'Text "\8217 is a built-in type") ':<>: 'Text " so you can embed any of its values as a constant")) ':$$: 'Text "If you still want a built-in function, add a dummy \8216()\8217 argument") :: Constraint | |
| ThrowOnBothEmpty ('[] :: [Some TyNameRep]) ('[] :: [Type]) 'False a = TypeError ('Text "A built-in function must take at least one type or term argument" ':$$: 'Text "To fix this error add a dummy \8216()\8217 argument") :: Constraint | |
| ThrowOnBothEmpty _1 _2 _3 _4 = () |
toBuiltinRuntime :: cost -> BuiltinMeaning val cost -> BuiltinRuntime val Source #
Convert a BuiltinMeaning to a BuiltinRuntime given a cost model.
toBuiltinsRuntime :: forall cost (uni :: Type -> Type) fun val. (cost ~ CostingPart uni fun, ToBuiltinMeaning uni fun, HasMeaningIn uni val) => BuiltinSemanticsVariant fun -> cost -> BuiltinsRuntime fun val Source #
Calculate runtime info for all built-in functions given meanings of builtins (as a constraint), the semantics variant of the set of builtins and a cost model.
class AnnotateCaseBuiltin (uni :: Type -> Type) where Source #
Methods
annotateCaseBuiltin :: UniOf term ~ uni => Type TyName uni ann -> [term] -> Either Text [(term, [Type TyName uni ann])] Source #
Given a tag for a built-in type and a list of branches, annotate each of the branches with its expected argument types or fail if casing on values of the built-in type isn't supported. Note: you don't need to include the resulting type of the whole case matching in the returning list here.
Instances
| AnnotateCaseBuiltin DefaultUni Source # | |
Defined in PlutusCore.Default.Universe Methods annotateCaseBuiltin :: UniOf term ~ DefaultUni => Type TyName DefaultUni ann -> [term] -> Either Text [(term, [Type TyName DefaultUni ann])] Source # | |
data CaserBuiltin (uni :: Type -> Type) Source #
A data version of CaseBuiltin. we parameterize the evaluator by a CaserBuiltin so that
the caller can choose whether to use the caseBuiltin method or the always failing caser (the
latter is required for earlier protocol versions when we didn't support casing on builtins).
Constructors
| CaserBuiltin | |
Instances
| CaseBuiltin uni => Default (CaserBuiltin uni) Source # | |
Defined in PlutusCore.Builtin.Case Methods def :: CaserBuiltin uni # | |
| NFData (CaserBuiltin uni) Source # | |
Defined in PlutusCore.Builtin.Case Methods rnf :: CaserBuiltin uni -> () Source # | |
| NoThunks (CaserBuiltin uni) Source # | |
Defined in PlutusCore.Builtin.Case Methods noThunks :: Context -> CaserBuiltin uni -> IO (Maybe ThunkInfo) wNoThunks :: Context -> CaserBuiltin uni -> IO (Maybe ThunkInfo) showTypeOf :: Proxy (CaserBuiltin uni) -> String | |
unavailableCaserBuiltin :: forall (uni :: Type -> Type). Int -> CaserBuiltin uni Source #