plutus-core
Safe HaskellNone
LanguageHaskell2010

PlutusCore.Builtin

Description

Reexports from modules from the Builtin folder.

Synopsis

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.

Constructors

Opaque 

Fields

Instances

Instances details
KnownTypeAst tyname uni rep => KnownTypeAst tyname uni (Opaque val rep :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

Associated Types

type IsBuiltin uni (Opaque val rep :: Type) 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (Opaque val rep :: Type) = 'False

Methods

typeAst :: Type tyname uni () Source #

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

Defined in PlutusCore.Builtin.KnownType

Methods

makeKnown :: Opaque val rep -> BuiltinResult val Source #

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

Defined in PlutusCore.Builtin.KnownType

Methods

readKnown :: val -> ReadKnownM (Opaque val rep) Source #

(TypeError NoConstraintsErrMsg :: Constraint) => Monoid (Opaque val rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

mempty :: Opaque val rep Source #

mappend :: Opaque val rep -> Opaque val rep -> Opaque val rep Source #

mconcat :: [Opaque val rep] -> Opaque val rep Source #

(TypeError NoConstraintsErrMsg :: Constraint) => Semigroup (Opaque val rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

(<>) :: Opaque val rep -> Opaque val rep -> Opaque val rep Source #

sconcat :: NonEmpty (Opaque val rep) -> Opaque val rep Source #

stimes :: Integral b => b -> Opaque val rep -> Opaque val rep Source #

(TypeError NoConstraintsErrMsg :: Constraint) => Bounded (Opaque val rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

minBound :: Opaque val rep Source #

maxBound :: Opaque val rep Source #

(TypeError NoConstraintsErrMsg :: Constraint) => Enum (Opaque val rep) Source # 
Instance details

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 # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

range :: (Opaque val rep, Opaque val rep) -> [Opaque val rep] Source #

index :: (Opaque val rep, Opaque val rep) -> Opaque val rep -> Int Source #

unsafeIndex :: (Opaque val rep, Opaque val rep) -> Opaque val rep -> Int Source #

inRange :: (Opaque val rep, Opaque val rep) -> Opaque val rep -> Bool Source #

rangeSize :: (Opaque val rep, Opaque val rep) -> Int Source #

unsafeRangeSize :: (Opaque val rep, Opaque val rep) -> Int Source #

(TypeError NoConstraintsErrMsg :: Constraint) => Num (Opaque val rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

(+) :: Opaque val rep -> Opaque val rep -> Opaque val rep Source #

(-) :: Opaque val rep -> Opaque val rep -> Opaque val rep Source #

(*) :: Opaque val rep -> Opaque val rep -> Opaque val rep Source #

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 # 
Instance details

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 #

toInteger :: Opaque val rep -> Integer Source #

(TypeError NoConstraintsErrMsg :: Constraint) => Real (Opaque val rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

toRational :: Opaque val rep -> Rational Source #

(TypeError NoConstraintsErrMsg :: Constraint) => Eq (Opaque val rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

(==) :: Opaque val rep -> Opaque val rep -> Bool Source #

(/=) :: Opaque val rep -> Opaque val rep -> Bool Source #

(TypeError NoConstraintsErrMsg :: Constraint) => Ord (Opaque val rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

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 # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

asConstant :: Opaque val rep -> Either BuiltinError (Some (ValueOf (UniOf (Opaque val rep)))) Source #

fromConstant :: Some (ValueOf (UniOf (Opaque val rep))) -> Opaque val rep Source #

ExMemoryUsage val => ExMemoryUsage (Opaque val rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

memoryUsage :: Opaque val rep -> CostRose Source #

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

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds uni acc (Opaque val rep :: Type) = ToBinds uni acc rep
type ToHoles uni _1 (Opaque val rep :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles uni _1 (Opaque val rep :: Type) = '[RepHole rep :: Hole]
type IsBuiltin uni (Opaque val rep :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

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

Defined in PlutusCore.Builtin.Polymorphism

type UniOf (Opaque val rep) = UniOf val

data SingKind k where Source #

The type of singletonized Haskell kinds representing Plutus kinds. Indexing by a Haskell kind allows us to avoid an error call in the ToKind instance of DefaultUni and not worry about proxies in the type of knownKind.

Constructors

SingType :: SingKind Type 
SingKindArrow :: forall k1 l. SingKind k1 -> SingKind l -> SingKind (k1 -> l) infixr 5 

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:

  1. everything is strict
  2. has the BuiltinSuccess constructor 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.

Instances

Instances details
MonadFail BuiltinResult Source # 
Instance details

Defined in PlutusCore.Builtin.Result

Foldable BuiltinResult Source # 
Instance details

Defined in PlutusCore.Builtin.Result

Methods

fold :: Monoid m => BuiltinResult m -> m Source #

foldMap :: Monoid m => (a -> m) -> BuiltinResult a -> m Source #

foldMap' :: Monoid m => (a -> m) -> BuiltinResult a -> m Source #

foldr :: (a -> b -> b) -> b -> BuiltinResult a -> b Source #

foldr' :: (a -> b -> b) -> b -> BuiltinResult a -> b Source #

foldl :: (b -> a -> b) -> b -> BuiltinResult a -> b Source #

foldl' :: (b -> a -> b) -> b -> BuiltinResult a -> b Source #

foldr1 :: (a -> a -> a) -> BuiltinResult a -> a Source #

foldl1 :: (a -> a -> a) -> BuiltinResult a -> a Source #

toList :: BuiltinResult a -> [a] Source #

null :: BuiltinResult a -> Bool Source #

length :: BuiltinResult a -> Int Source #

elem :: Eq a => a -> BuiltinResult a -> Bool Source #

maximum :: Ord a => BuiltinResult a -> a Source #

minimum :: Ord a => BuiltinResult a -> a Source #

sum :: Num a => BuiltinResult a -> a Source #

product :: Num a => BuiltinResult a -> a Source #

Applicative BuiltinResult Source # 
Instance details

Defined in PlutusCore.Builtin.Result

Functor BuiltinResult Source # 
Instance details

Defined in PlutusCore.Builtin.Result

Methods

fmap :: (a -> b) -> BuiltinResult a -> BuiltinResult b Source #

(<$) :: a -> BuiltinResult b -> BuiltinResult a Source #

Monad BuiltinResult Source # 
Instance details

Defined in PlutusCore.Builtin.Result

MonadError BuiltinError BuiltinResult Source #

throwError puts every operational unlifting error into the BuiltinFailure logs. This is to compensate for the historical lack of error message content in operational errors (structural ones don't have this problem) in our evaluators (the CK and CEK machines). It would be better to fix the underlying issue and allow operational evaluation errors to carry some form of content, but for now we just fix the symptom in order for the end user to see the error message that they are supposed to see. The fix even makes some sense: what we do here is we emulate logging when the thrown unlifting error is an operational one, i.e. this is similar to what some builtins do manually (like when a crypto builtin fails and puts info about the failure into the logs).

Instance details

Defined in PlutusCore.Builtin.Result

KnownTypeAst tyname uni a => KnownTypeAst tyname uni (BuiltinResult a :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

Associated Types

type IsBuiltin uni (BuiltinResult a :: Type) 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (BuiltinResult a :: Type) = 'False

Methods

typeAst :: Type tyname uni () Source #

MakeKnownIn uni val a => MakeKnownIn uni val (BuiltinResult a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownType

(TypeError ('Text "\8216BuiltinResult\8217 cannot appear in the type of an argument") :: Constraint, uni ~ UniOf val) => ReadKnownIn uni val (BuiltinResult a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownType

Show a => Show (BuiltinResult a) Source # 
Instance details

Defined in PlutusCore.Builtin.Result

type ToBinds uni acc (BuiltinResult a :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds uni acc (BuiltinResult a :: Type) = ToBinds uni acc a
type ToHoles uni _1 (BuiltinResult a :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles uni _1 (BuiltinResult a :: Type) = '[TypeHole a :: Hole]
type IsBuiltin uni (BuiltinResult a :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (BuiltinResult a :: Type) = 'False

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

Instances details
HasConstant val => HasConstant (Opaque val rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

asConstant :: Opaque val rep -> Either BuiltinError (Some (ValueOf (UniOf (Opaque val rep)))) Source #

fromConstant :: Some (ValueOf (UniOf (Opaque val rep))) -> Opaque val rep Source #

HasConstant (SomeConstant uni rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

HasConstant (CkValue uni fun) Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.Ck

Methods

asConstant :: CkValue uni fun -> Either BuiltinError (Some (ValueOf (UniOf (CkValue uni fun)))) Source #

fromConstant :: Some (ValueOf (UniOf (CkValue uni fun))) -> CkValue uni fun Source #

HasConstant (CekValue uni fun ann) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

asConstant :: CekValue uni fun ann -> Either BuiltinError (Some (ValueOf (UniOf (CekValue uni fun ann)))) Source #

fromConstant :: Some (ValueOf (UniOf (CekValue uni fun ann))) -> CekValue uni fun ann Source #

HasConstant (Term name uni fun ()) Source # 
Instance details

Defined in UntypedPlutusCore.Core.Type

Methods

asConstant :: Term name uni fun () -> Either BuiltinError (Some (ValueOf (UniOf (Term name uni fun ())))) Source #

fromConstant :: Some (ValueOf (UniOf (Term name uni fun ()))) -> Term name uni fun () Source #

HasConstant (Term TyName Name uni fun ()) Source # 
Instance details

Defined in PlutusCore.Builtin.HasConstant

Methods

asConstant :: Term TyName Name uni fun () -> Either BuiltinError (Some (ValueOf (UniOf (Term TyName Name uni fun ())))) Source #

fromConstant :: Some (ValueOf (UniOf (Term TyName Name uni fun ()))) -> Term TyName Name uni fun () Source #

class KnownKind k where Source #

For reifying Haskell kinds representing Plutus kinds at the term level.

Instances

Instances details
rep ~ LiftedRep => KnownKind (TYPE rep) Source #

Plutus only supports lifted types, hence the equality constraint.

Instance details

Defined in PlutusCore.Builtin.KnownKind

Methods

knownKind :: SingKind (TYPE rep) Source #

(KnownKind dom, KnownKind cod) => KnownKind (dom -> cod) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownKind

Methods

knownKind :: SingKind (dom -> cod) Source #

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.

type ToBinds (uni :: Type -> Type) (acc :: [Some TyNameRep]) (x :: a) = ToBinds uni acc (ElaborateBuiltin uni x)

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

Instances details
tyname ~ TyName => KnownTypeAst tyname DefaultUni Void Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

Associated Types

type IsBuiltin DefaultUni Void 
Instance details

Defined in PlutusCore.Examples.Builtins

type ToHoles DefaultUni _1 Void 
Instance details

Defined in PlutusCore.Examples.Builtins

type ToHoles DefaultUni _1 Void = '[] :: [Hole]
type ToBinds DefaultUni acc Void 
Instance details

Defined in PlutusCore.Examples.Builtins

type ToBinds DefaultUni acc Void = acc

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownTypeAst tyname DefaultUni Int16 Source # 
Instance details

Defined in PlutusCore.Default.Universe

Associated Types

type IsBuiltin DefaultUni Int16 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Int16 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Int16 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownTypeAst tyname DefaultUni Int32 Source # 
Instance details

Defined in PlutusCore.Default.Universe

Associated Types

type IsBuiltin DefaultUni Int32 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Int32 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Int32 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownTypeAst tyname DefaultUni Int64 Source # 
Instance details

Defined in PlutusCore.Default.Universe

Associated Types

type IsBuiltin DefaultUni Int64 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Int64 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Int64 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownTypeAst tyname DefaultUni Int8 Source # 
Instance details

Defined in PlutusCore.Default.Universe

Associated Types

type IsBuiltin DefaultUni Int8 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Int8 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Int8 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownTypeAst tyname DefaultUni Word16 Source # 
Instance details

Defined in PlutusCore.Default.Universe

Associated Types

type IsBuiltin DefaultUni Word16 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Word16 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Word16 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownTypeAst tyname DefaultUni Word32 Source # 
Instance details

Defined in PlutusCore.Default.Universe

Associated Types

type IsBuiltin DefaultUni Word32 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Word32 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Word32 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownTypeAst tyname DefaultUni Word64 Source # 
Instance details

Defined in PlutusCore.Default.Universe

Associated Types

type IsBuiltin DefaultUni Word64 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Word64 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Word64 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownTypeAst tyname DefaultUni Word8 Source # 
Instance details

Defined in PlutusCore.Default.Universe

Associated Types

type IsBuiltin DefaultUni Word8 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Word8 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Word8 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownBuiltinTypeAst tyname DefaultUni ByteString => KnownTypeAst tyname DefaultUni ByteString Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownBuiltinTypeAst tyname DefaultUni Element => KnownTypeAst tyname DefaultUni Element Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownBuiltinTypeAst tyname DefaultUni Element => KnownTypeAst tyname DefaultUni Element Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownBuiltinTypeAst tyname DefaultUni MlResult => KnownTypeAst tyname DefaultUni MlResult Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownBuiltinTypeAst tyname DefaultUni Data => KnownTypeAst tyname DefaultUni Data Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownTypeAst tyname DefaultUni DataNodeCount Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownTypeAst tyname DefaultUni IntegerCostedLiterally Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownTypeAst tyname DefaultUni NumBytesCostedAsNumWords Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownTypeAst tyname DefaultUni ValueMaxDepth Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownTypeAst tyname DefaultUni ValueTotalSize Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownBuiltinTypeAst tyname DefaultUni Value => KnownTypeAst tyname DefaultUni Value Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownBuiltinTypeAst tyname DefaultUni Text => KnownTypeAst tyname DefaultUni Text Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownBuiltinTypeAst tyname DefaultUni Integer => KnownTypeAst tyname DefaultUni Integer Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownTypeAst tyname DefaultUni Natural Source # 
Instance details

Defined in PlutusCore.Default.Universe

Associated Types

type IsBuiltin DefaultUni Natural 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Natural 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Natural 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownBuiltinTypeAst tyname DefaultUni () => KnownTypeAst tyname DefaultUni () Source # 
Instance details

Defined in PlutusCore.Default.Universe

Associated Types

type IsBuiltin DefaultUni () 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole () 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc () 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownBuiltinTypeAst tyname DefaultUni Bool => KnownTypeAst tyname DefaultUni Bool Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownTypeAst tyname DefaultUni Int Source # 
Instance details

Defined in PlutusCore.Default.Universe

Associated Types

type IsBuiltin DefaultUni Int 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Int 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Int 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownTypeAst tyname DefaultUni Word Source # 
Instance details

Defined in PlutusCore.Default.Universe

Associated Types

type IsBuiltin DefaultUni Word 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Word 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Word 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownBuiltinTypeAst tyname DefaultUni (Vector a) => KnownTypeAst tyname DefaultUni (Vector a :: Type) Source # 
Instance details

Defined in PlutusCore.Default.Universe

Associated Types

type IsBuiltin DefaultUni (Vector a :: Type) 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownBuiltinTypeAst tyname DefaultUni [a] => KnownTypeAst tyname DefaultUni ([a] :: Type) Source # 
Instance details

Defined in PlutusCore.Default.Universe

Associated Types

type IsBuiltin DefaultUni ([a] :: Type) 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownTypeAst tyname uni a => KnownTypeAst tyname uni (BuiltinResult a :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

Associated Types

type IsBuiltin uni (BuiltinResult a :: Type) 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (BuiltinResult a :: Type) = 'False

Methods

typeAst :: Type tyname uni () Source #

KnownTypeAst tyname uni a => KnownTypeAst tyname uni (EvaluationResult a :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

Associated Types

type IsBuiltin uni (EvaluationResult a :: Type) 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

Methods

typeAst :: Type tyname uni () Source #

(tyname ~ TyName, KnownTypeAst tyname uni a) => KnownTypeAst tyname uni (PlcListRep a :: Type) Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

Associated Types

type IsBuiltin uni (PlcListRep a :: Type) 
Instance details

Defined in PlutusCore.Examples.Builtins

type IsBuiltin uni (PlcListRep a :: Type) = 'False

Methods

typeAst :: Type tyname uni () Source #

KnownBuiltinTypeAst tyname DefaultUni (a, b) => KnownTypeAst tyname DefaultUni ((a, b) :: Type) Source # 
Instance details

Defined in PlutusCore.Default.Universe

Associated Types

type IsBuiltin DefaultUni ((a, b) :: Type) 
Instance details

Defined in PlutusCore.Default.Universe

Methods

typeAst :: Type tyname DefaultUni () Source #

KnownTypeAst tyname uni y => KnownTypeAst tyname uni (LastArg x y :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

Associated Types

type IsBuiltin uni (LastArg x y :: Type) 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (LastArg x y :: Type) = IsBuiltin uni y

Methods

typeAst :: Type tyname uni () Source #

KnownTypeAst tyname uni rep => KnownTypeAst tyname uni (Opaque val rep :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

Associated Types

type IsBuiltin uni (Opaque val rep :: Type) 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (Opaque val rep :: Type) = 'False

Methods

typeAst :: Type tyname uni () Source #

KnownTypeAst tyname uni rep => KnownTypeAst tyname uni (SomeConstant uni rep :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

Associated Types

type IsBuiltin uni (SomeConstant uni rep :: Type) 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (SomeConstant uni rep :: Type) = 'False

Methods

typeAst :: Type tyname uni () Source #

(KnownTypeAst tyname uni a, KnownTypeAst tyname uni b) => KnownTypeAst tyname uni (a -> b :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

Associated Types

type IsBuiltin uni (a -> b :: Type) 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (a -> b :: Type) = 'False

Methods

typeAst :: Type tyname uni () Source #

Contains uni f => KnownTypeAst tyname uni (BuiltinHead f :: a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

Associated Types

type IsBuiltin uni (BuiltinHead f :: a) 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (BuiltinHead f :: a) = 'True

Methods

typeAst :: Type tyname uni () Source #

(tyname ~ TyName, name ~ ('TyNameRep text uniq :: TyNameRep a), KnownSymbol text, KnownNat uniq) => KnownTypeAst tyname uni (TyVarRep name :: a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

Associated Types

type IsBuiltin uni (TyVarRep name :: a) 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (TyVarRep name :: a) = 'False

Methods

typeAst :: Type tyname uni () 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 # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

Associated Types

type IsBuiltin uni (TyForallRep name a :: Type) 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (TyForallRep name a :: Type) = 'False

Methods

typeAst :: Type tyname uni () Source #

(name ~ ('TyNameRep text uniq :: TyNameRep kind), KnownSymbol text, KnownNat uniq, KnownKind kind, KnownTypeAst tyname uni a) => KnownTypeAst tyname uni (MetaForall name a :: Type) Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

Associated Types

type IsBuiltin uni (MetaForall name a :: Type) 
Instance details

Defined in PlutusCore.Examples.Builtins

type IsBuiltin uni (MetaForall name a :: Type) = 'False

Methods

typeAst :: Type tyname uni () Source #

(KnownTypeAst tyname uni fun, KnownTypeAst tyname uni arg) => KnownTypeAst tyname uni (TyAppRep fun arg :: a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

Associated Types

type IsBuiltin uni (TyAppRep fun arg :: a) 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (TyAppRep fun arg :: a) = IsBuiltin uni fun && IsBuiltin uni arg

Methods

typeAst :: Type tyname uni () 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

Instances details
Show (TypeScheme val args res) Source # 
Instance details

Defined in PlutusCore.Builtin.TypeScheme

Methods

showsPrec :: Int -> TypeScheme val args res -> ShowS Source #

show :: TypeScheme val args res -> String Source #

showList :: [TypeScheme val args res] -> ShowS Source #

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

Instances details
uni ~ DefaultUni => ToBuiltinMeaning uni DefaultFun Source # 
Instance details

Defined in PlutusCore.Default.Builtins

uni ~ DefaultUni => ToBuiltinMeaning uni ExtensionFun Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

(ToBuiltinMeaning uni fun1, ToBuiltinMeaning uni fun2, Default (BuiltinSemanticsVariant fun1), Default (BuiltinSemanticsVariant fun2)) => ToBuiltinMeaning uni (Either fun1 fun2) Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

Associated Types

type CostingPart uni (Either fun1 fun2) 
Instance details

Defined in PlutusCore.Examples.Builtins

type CostingPart uni (Either fun1 fun2) = (CostingPart uni fun1, CostingPart uni fun2)
data BuiltinSemanticsVariant (Either fun1 fun2) 
Instance details

Defined in PlutusCore.Examples.Builtins

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

Instances details
Bounded (BuiltinSemanticsVariant DefaultFun) Source # 
Instance details

Defined in PlutusCore.Default.Builtins

Bounded (BuiltinSemanticsVariant ExtensionFun) Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

Enum (BuiltinSemanticsVariant DefaultFun) Source # 
Instance details

Defined in PlutusCore.Default.Builtins

Enum (BuiltinSemanticsVariant ExtensionFun) Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

Generic (BuiltinSemanticsVariant DefaultFun) Source # 
Instance details

Defined in PlutusCore.Default.Builtins

Associated Types

type Rep (BuiltinSemanticsVariant DefaultFun) 
Instance details

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))))
Show (BuiltinSemanticsVariant DefaultFun) Source # 
Instance details

Defined in PlutusCore.Default.Builtins

Show (BuiltinSemanticsVariant ExtensionFun) Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

(Default (BuiltinSemanticsVariant fun1), Default (BuiltinSemanticsVariant fun2)) => Default (BuiltinSemanticsVariant (Either fun1 fun2)) Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

Methods

def :: BuiltinSemanticsVariant (Either fun1 fun2) #

Default (BuiltinSemanticsVariant DefaultFun) Source # 
Instance details

Defined in PlutusCore.Default.Builtins

Default (BuiltinSemanticsVariant ExtensionFun) Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

NFData (BuiltinSemanticsVariant DefaultFun) Source # 
Instance details

Defined in PlutusCore.Default.Builtins

Eq (BuiltinSemanticsVariant DefaultFun) Source # 
Instance details

Defined in PlutusCore.Default.Builtins

Eq (BuiltinSemanticsVariant ExtensionFun) Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

Ord (BuiltinSemanticsVariant DefaultFun) Source # 
Instance details

Defined in PlutusCore.Default.Builtins

Ord (BuiltinSemanticsVariant ExtensionFun) Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

NoThunks (BuiltinSemanticsVariant DefaultFun) 
Instance details

Defined in PlutusCore.Default.Builtins

Pretty (BuiltinSemanticsVariant DefaultFun) Source # 
Instance details

Defined in PlutusCore.Default.Builtins

data BuiltinSemanticsVariant DefaultFun Source # 
Instance details

Defined in PlutusCore.Default.Builtins

data BuiltinSemanticsVariant ExtensionFun Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

type Rep (BuiltinSemanticsVariant DefaultFun) Source # 
Instance details

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 # 
Instance details

Defined in PlutusCore.Examples.Builtins

data EvaluationError structural operational Source #

The type of errors that can occur during evaluation. There are two kinds of errors:

  1. 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 tailList was applied to a non-list.
  2. Operational ones -- these are errors that are indicative of the _logic_ of the program being wrong. For example, error was executed, tailList was 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

Instances details
Bifoldable EvaluationError Source # 
Instance details

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 # 
Instance details

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 # 
Instance details

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 # 
Instance details

Defined in PlutusCore.Evaluation.Error

Methods

prettyBy :: config -> EvaluationError structural operational -> Doc ann #

prettyListBy :: config -> [EvaluationError structural operational] -> Doc ann #

Functor (EvaluationError structural) Source # 
Instance details

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 # 
Instance details

Defined in PlutusCore.Evaluation.Error

Associated Types

type Rep (EvaluationError structural operational) 
Instance details

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)))

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 # 
Instance details

Defined in PlutusCore.Evaluation.Error

Methods

showsPrec :: Int -> EvaluationError structural operational -> ShowS Source #

show :: EvaluationError structural operational -> String Source #

showList :: [EvaluationError structural operational] -> ShowS Source #

(NFData structural, NFData operational) => NFData (EvaluationError structural operational) Source # 
Instance details

Defined in PlutusCore.Evaluation.Error

Methods

rnf :: EvaluationError structural operational -> () Source #

(Eq structural, Eq operational) => Eq (EvaluationError structural operational) Source # 
Instance details

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 # 
Instance details

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 # 
Instance details

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 # 
Instance details

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 

data BuiltinError Source #

The type of errors that readKnown and makeKnown can return.

Instances

Instances details
Show BuiltinError Source # 
Instance details

Defined in PlutusCore.Builtin.Result

Eq BuiltinError Source # 
Instance details

Defined in PlutusCore.Builtin.Result

Pretty BuiltinError Source # 
Instance details

Defined in PlutusCore.Builtin.Result

Methods

pretty :: BuiltinError -> Doc ann #

prettyList :: [BuiltinError] -> Doc ann #

MonadError BuiltinError BuiltinResult Source #

throwError puts every operational unlifting error into the BuiltinFailure logs. This is to compensate for the historical lack of error message content in operational errors (structural ones don't have this problem) in our evaluators (the CK and CEK machines). It would be better to fix the underlying issue and allow operational evaluation errors to carry some form of content, but for now we just fix the symptom in order for the end user to see the error message that they are supposed to see. The fix even makes some sense: what we do here is we emulate logging when the thrown unlifting error is an operational one, i.e. this is similar to what some builtins do manually (like when a crypto builtin fails and puts info about the failure into the logs).

Instance details

Defined in PlutusCore.Builtin.Result

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

Instances details
ToKind DefaultUni Source # 
Instance details

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

Instances details
(Bounded fun, Enum fun) => NFData (BuiltinsRuntime fun val) Source # 
Instance details

Defined in PlutusCore.Builtin.Runtime

Methods

rnf :: BuiltinsRuntime fun val -> () Source #

(Bounded fun, Enum fun) => NoThunks (BuiltinsRuntime fun val) Source # 
Instance details

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

Instances details
CaseBuiltin DefaultUni Source # 
Instance details

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.

Constructors

HeadOnly a 
HeadSpine a (Spine b) 
HeadError ~err 

Instances

Instances details
(PrettyBy config err, PrettyBy config a, PrettyBy config (Spine b)) => DefaultPrettyBy config (HeadSpine err a b) Source # 
Instance details

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 # 
Instance details

Defined in PlutusCore.Builtin.KnownType

Methods

prettyBy :: config -> HeadSpine err a b -> Doc ann #

prettyListBy :: config -> [HeadSpine err a b] -> Doc ann #

Bifunctor (HeadSpine err) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownType

Methods

bimap :: (a -> b) -> (c -> d) -> HeadSpine err a c -> HeadSpine err b d Source #

first :: (a -> b) -> HeadSpine err a c -> HeadSpine err b c Source #

second :: (b -> c) -> HeadSpine err a b -> HeadSpine err a c Source #

Functor (HeadSpine err a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownType

Methods

fmap :: (a0 -> b) -> HeadSpine err a a0 -> HeadSpine err a b Source #

(<$) :: a0 -> HeadSpine err a b -> HeadSpine err a a0 Source #

(Show a, Show b, Show err) => Show (HeadSpine err a b) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownType

Methods

showsPrec :: Int -> HeadSpine err a b -> ShowS Source #

show :: HeadSpine err a b -> String Source #

showList :: [HeadSpine err a b] -> ShowS Source #

(Eq a, Eq b, Eq err) => Eq (HeadSpine err a b) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownType

Methods

(==) :: HeadSpine err a b -> HeadSpine err a b -> Bool Source #

(/=) :: HeadSpine err a b -> HeadSpine err a b -> Bool Source #

(Pretty err, Pretty a, Pretty b) => Pretty (HeadSpine err a b) Source #
>>> import Text.Pretty
>>> pretty (HeadOnly 'z')
z
>>> pretty (HeadSpine 'f' (SpineCons 'x' $ SpineLast 'y'))
f `applyN` [x, y] 
Instance details

Defined in PlutusCore.Builtin.KnownType

Methods

pretty :: HeadSpine err a b -> Doc ann #

prettyList :: [HeadSpine err a b] -> Doc ann #

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.

Methods

geqL :: f (Esc a) -> f (Esc b) -> EvaluationResult (a :~: b) Source #

Instances

Instances details
AllBuiltinArgs DefaultUni (GEqL DefaultUni) a => GEqL DefaultUni a Source # 
Instance details

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 # 
Instance details

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

Instances details
GEqL uni a => GEqL (LoopBreaker uni) a Source # 
Instance details

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.

data Spine a Source #

A non-empty spine. Isomorphic to NonEmpty, except is strict and is defined as a single recursive data type.

Constructors

SpineLast a 
SpineCons a (Spine a) 

Instances

Instances details
Foldable Spine Source # 
Instance details

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 #

sum :: Num a => Spine a -> a Source #

product :: Num a => Spine a -> a Source #

Functor Spine Source # 
Instance details

Defined in PlutusCore.Builtin.KnownType

Methods

fmap :: (a -> b) -> Spine a -> Spine b Source #

(<$) :: a -> Spine b -> Spine a Source #

PrettyBy config a => DefaultPrettyBy config (Spine a) Source # 
Instance details

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 # 
Instance details

Defined in PlutusCore.Builtin.KnownType

Methods

prettyBy :: config -> Spine a -> Doc ann #

prettyListBy :: config -> [Spine a] -> Doc ann #

Show a => Show (Spine a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownType

Eq a => Eq (Spine a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownType

Methods

(==) :: Spine a -> Spine a -> Bool Source #

(/=) :: Spine a -> Spine a -> Bool Source #

Pretty a => Pretty (Spine a) Source #
>>> import Text.Pretty
>>> pretty (SpineCons 'a' $ SpineLast 'b')
[a, b] 
Instance details

Defined in PlutusCore.Builtin.KnownType

Methods

pretty :: Spine a -> Doc ann #

prettyList :: [Spine a] -> Doc ann #

headSpine :: a -> [b] -> HeadSpine err a b Source #

Construct HeadSpine from head and list.

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

Instances details
UniOf term ~ DefaultUni => MakeKnownIn DefaultUni term Void Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

Methods

makeKnown :: Void -> BuiltinResult term Source #

KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term Int16 Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term Int32 Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term Int64 Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term Int8 Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

makeKnown :: Int8 -> BuiltinResult term Source #

KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term Word16 Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term Word32 Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term Word64 Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term Word8 Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term ByteString => MakeKnownIn DefaultUni term ByteString Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term Element => MakeKnownIn DefaultUni term Element Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term Element => MakeKnownIn DefaultUni term Element Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term MlResult => MakeKnownIn DefaultUni term MlResult Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term Data => MakeKnownIn DefaultUni term Data Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

makeKnown :: Data -> BuiltinResult term Source #

KnownBuiltinTypeIn DefaultUni term Value => MakeKnownIn DefaultUni term DataNodeCount Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term IntegerCostedLiterally Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term NumBytesCostedAsNumWords Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term Value => MakeKnownIn DefaultUni term ValueMaxDepth Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term Value => MakeKnownIn DefaultUni term ValueTotalSize Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term Value => MakeKnownIn DefaultUni term Value Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term Text => MakeKnownIn DefaultUni term Text Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

makeKnown :: Text -> BuiltinResult term Source #

KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term Integer Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term Natural Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term () => MakeKnownIn DefaultUni term () Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

makeKnown :: () -> BuiltinResult term Source #

KnownBuiltinTypeIn DefaultUni term Bool => MakeKnownIn DefaultUni term Bool Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

makeKnown :: Bool -> BuiltinResult term Source #

KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term Int Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

makeKnown :: Int -> BuiltinResult term Source #

KnownBuiltinTypeIn DefaultUni term Integer => MakeKnownIn DefaultUni term Word Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

makeKnown :: Word -> BuiltinResult term Source #

KnownBuiltinTypeIn DefaultUni term (Vector a) => MakeKnownIn DefaultUni term (Vector a) Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

makeKnown :: Vector a -> BuiltinResult term Source #

KnownBuiltinTypeIn DefaultUni term [a] => MakeKnownIn DefaultUni term [a] Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

makeKnown :: [a] -> BuiltinResult term Source #

MakeKnownIn uni val a => MakeKnownIn uni val (BuiltinResult a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownType

(TypeError ('Text "Use \8216BuiltinResult\8217 instead of \8216EvaluationResult\8217") :: Constraint, uni ~ UniOf val) => MakeKnownIn uni val (EvaluationResult a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownType

KnownBuiltinTypeIn DefaultUni term (a, b) => MakeKnownIn DefaultUni term (a, b) Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

makeKnown :: (a, b) -> BuiltinResult term Source #

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

Defined in PlutusCore.Builtin.KnownType

Methods

makeKnown :: Opaque val rep -> BuiltinResult val Source #

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

Defined in PlutusCore.Builtin.KnownType

Methods

makeKnown :: SomeConstant uni rep -> BuiltinResult val Source #

MakeKnownIn DefaultUni term a => MakeKnownIn DefaultUni term (MetaForall name a) Source # 
Instance details

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

Instances details
UniOf term ~ DefaultUni => ReadKnownIn DefaultUni term Void Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

Methods

readKnown :: term -> ReadKnownM Void Source #

KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term Int16 Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

readKnown :: term -> ReadKnownM Int16 Source #

KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term Int32 Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

readKnown :: term -> ReadKnownM Int32 Source #

KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term Int64 Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

readKnown :: term -> ReadKnownM Int64 Source #

KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term Int8 Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

readKnown :: term -> ReadKnownM Int8 Source #

KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term Word16 Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

readKnown :: term -> ReadKnownM Word16 Source #

KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term Word32 Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

readKnown :: term -> ReadKnownM Word32 Source #

KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term Word64 Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

readKnown :: term -> ReadKnownM Word64 Source #

KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term Word8 Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

readKnown :: term -> ReadKnownM Word8 Source #

KnownBuiltinTypeIn DefaultUni term ByteString => ReadKnownIn DefaultUni term ByteString Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term Element => ReadKnownIn DefaultUni term Element Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

readKnown :: term -> ReadKnownM Element Source #

KnownBuiltinTypeIn DefaultUni term Element => ReadKnownIn DefaultUni term Element Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

readKnown :: term -> ReadKnownM Element Source #

KnownBuiltinTypeIn DefaultUni term MlResult => ReadKnownIn DefaultUni term MlResult Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term Data => ReadKnownIn DefaultUni term Data Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

readKnown :: term -> ReadKnownM Data Source #

KnownBuiltinTypeIn DefaultUni term Value => ReadKnownIn DefaultUni term DataNodeCount Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term IntegerCostedLiterally Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term NumBytesCostedAsNumWords Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term Value => ReadKnownIn DefaultUni term ValueMaxDepth Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term Value => ReadKnownIn DefaultUni term ValueTotalSize Source # 
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeIn DefaultUni term Value => ReadKnownIn DefaultUni term Value Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

readKnown :: term -> ReadKnownM Value Source #

KnownBuiltinTypeIn DefaultUni term Text => ReadKnownIn DefaultUni term Text Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

readKnown :: term -> ReadKnownM Text Source #

KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term Integer Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

readKnown :: term -> ReadKnownM Integer Source #

KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term Natural Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

readKnown :: term -> ReadKnownM Natural Source #

KnownBuiltinTypeIn DefaultUni term () => ReadKnownIn DefaultUni term () Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

readKnown :: term -> ReadKnownM () Source #

KnownBuiltinTypeIn DefaultUni term Bool => ReadKnownIn DefaultUni term Bool Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

readKnown :: term -> ReadKnownM Bool Source #

KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term Int Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

readKnown :: term -> ReadKnownM Int Source #

KnownBuiltinTypeIn DefaultUni term Integer => ReadKnownIn DefaultUni term Word Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

readKnown :: term -> ReadKnownM Word Source #

KnownBuiltinTypeIn DefaultUni term (Vector a) => ReadKnownIn DefaultUni term (Vector a) Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

readKnown :: term -> ReadKnownM (Vector a) Source #

KnownBuiltinTypeIn DefaultUni term [a] => ReadKnownIn DefaultUni term [a] Source # 
Instance details

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 # 
Instance details

Defined in PlutusCore.Builtin.KnownType

(TypeError ('Text "Use \8216BuiltinResult\8217 instead of \8216EvaluationResult\8217") :: Constraint, uni ~ UniOf val) => ReadKnownIn uni val (EvaluationResult a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownType

KnownBuiltinTypeIn DefaultUni term (a, b) => ReadKnownIn DefaultUni term (a, b) Source # 
Instance details

Defined in PlutusCore.Default.Universe

Methods

readKnown :: term -> ReadKnownM (a, b) Source #

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

Defined in PlutusCore.Builtin.KnownType

Methods

readKnown :: val -> ReadKnownM (Opaque val rep) Source #

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

Defined in PlutusCore.Builtin.KnownType

Methods

readKnown :: val -> ReadKnownM (SomeConstant uni rep) Source #

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.

data TyNameRep kind Source #

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

Constructors

TyNameRep Symbol Nat 

Instances

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

Defined in PlutusCore.Examples.Builtins

Associated Types

type IsBuiltin uni (MetaForall name a :: Type) 
Instance details

Defined in PlutusCore.Examples.Builtins

type IsBuiltin uni (MetaForall name a :: Type) = 'False

Methods

typeAst :: Type tyname uni () Source #

KnownMonotype val args res => KnownPolytype ('[] :: [Some TyNameRep]) val args res Source #

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

Instance details

Defined in PlutusCore.Builtin.Meaning

(TypeError NoStandalonePolymorphicDataErrMsg :: Constraint) => Contains uni (TyVarRep :: TyNameRep kind -> kind) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

knownUni :: uni (Esc (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 TypeSchemeAll.

Instance details

Defined in PlutusCore.Builtin.Meaning

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

Defined in PlutusCore.Examples.Builtins

type ToBinds uni acc (MetaForall name a :: Type) = ToBinds uni (Insert ('Some name) acc) a
type ToHoles uni _1 (MetaForall name a :: Type) Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

type ToHoles uni _1 (MetaForall name a :: Type) = '[TypeHole a :: Hole]
type IsBuiltin uni (MetaForall name a :: Type) Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

type IsBuiltin uni (MetaForall name a :: Type) = 'False

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

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

Instances

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

Defined in PlutusCore.Builtin.KnownTypeAst

Associated Types

type IsBuiltin uni (TyVarRep name :: a) 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (TyVarRep name :: a) = 'False

Methods

typeAst :: Type tyname uni () Source #

(TypeError NoStandalonePolymorphicDataErrMsg :: Constraint) => Contains uni (TyVarRep :: TyNameRep kind -> kind) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

knownUni :: uni (Esc (TyVarRep :: TyNameRep kind -> kind)) Source #

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

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds uni acc (TyVarRep name :: a) = Insert ('Some name) acc
type ToHoles uni _1 (TyVarRep name :: a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles uni _1 (TyVarRep name :: a) = '[] :: [Hole]
type IsBuiltin uni (TyVarRep name :: a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (TyVarRep name :: a) = 'False

data family TyAppRep (fun :: dom -> cod) (arg :: dom) :: cod Source #

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

Instances

Instances details
(KnownTypeAst tyname uni fun, KnownTypeAst tyname uni arg) => KnownTypeAst tyname uni (TyAppRep fun arg :: a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

Associated Types

type IsBuiltin uni (TyAppRep fun arg :: a) 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (TyAppRep fun arg :: a) = IsBuiltin uni fun && IsBuiltin uni arg

Methods

typeAst :: Type tyname uni () Source #

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

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds uni acc (TyAppRep fun arg :: a) = ToBinds uni (ToBinds uni acc fun) arg
type ToHoles uni _1 (TyAppRep fun arg :: a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles uni _1 (TyAppRep fun arg :: a) = '[RepHole fun :: Hole, RepHole arg :: Hole]
type IsBuiltin uni (TyAppRep fun arg :: a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (TyAppRep fun arg :: a) = IsBuiltin uni fun && IsBuiltin uni arg

data family TyForallRep (name :: TyNameRep kind) a Source #

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

Instances

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

Defined in PlutusCore.Builtin.KnownTypeAst

Associated Types

type IsBuiltin uni (TyForallRep name a :: Type) 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (TyForallRep name a :: Type) = 'False

Methods

typeAst :: Type tyname uni () Source #

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

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds uni acc (TyForallRep name a :: Type) = Delete ('Some name) (ToBinds uni acc a)
type ToHoles uni _1 (TyForallRep name a :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles uni _1 (TyForallRep name a :: Type) = '[RepHole a :: Hole]
type IsBuiltin uni (TyForallRep name a :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (TyForallRep name a :: Type) = 'False

data Hole Source #

The kind of holes.

data family RepHole (x :: a) :: hole Source #

A hole in the Rep context.

data family TypeHole a :: hole Source #

A hole in the Type context.

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.

Equations

RunHole (RepHole :: Type -> Type) = RepHole :: a -> Hole 
RunHole (TypeHole :: Type -> Type) = TypeHole :: Type -> Hole 

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.

Equations

Insert (x :: k) ('[] :: [k]) = '[x] 
Insert (x :: a) (x ': xs :: [a]) = x ': xs 
Insert (x :: a) (y ': xs :: [a]) = y ': Insert x xs 

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.

Equations

Delete (_1 :: a) ('[] :: [a]) = '[] :: [a] 
Delete (x :: a) (x ': xs :: [a]) = xs 
Delete (x :: a) (y ': xs :: [a]) = y ': Delete x xs 

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] Integer
FoldArgs [(), Bool] Integer :: *
= () -> Bool -> Integer 

Equations

FoldArgs ('[] :: [Type]) res = res 
FoldArgs (arg ': args) res = arg -> FoldArgs args res 

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

Instances details
KnownTypeAst tyname uni rep => KnownTypeAst tyname uni (SomeConstant uni rep :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

Associated Types

type IsBuiltin uni (SomeConstant uni rep :: Type) 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (SomeConstant uni rep :: Type) = 'False

Methods

typeAst :: Type tyname uni () Source #

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

Defined in PlutusCore.Builtin.KnownType

Methods

makeKnown :: SomeConstant uni rep -> BuiltinResult val Source #

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

Defined in PlutusCore.Builtin.KnownType

Methods

readKnown :: val -> ReadKnownM (SomeConstant uni rep) Source #

HasConstant (SomeConstant uni rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

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

Defined in PlutusCore.Builtin.Polymorphism

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

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds uni acc (SomeConstant uni rep :: Type) = ToBinds uni acc rep
type ToHoles uni _1 (SomeConstant uni rep :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles uni _1 (SomeConstant uni rep :: Type) = '[RepHole rep :: Hole]
type IsBuiltin uni (SomeConstant uni rep :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (SomeConstant uni rep :: Type) = 'False
type UniOf (SomeConstant uni rep) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

type UniOf (SomeConstant uni rep) = uni

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

Instances details
Contains uni f => KnownTypeAst tyname uni (BuiltinHead f :: a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

Associated Types

type IsBuiltin uni (BuiltinHead f :: a) 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (BuiltinHead f :: a) = 'True

Methods

typeAst :: Type tyname uni () Source #

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

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds uni acc (BuiltinHead f :: a) = acc
type ToHoles uni _1 (BuiltinHead f :: a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles uni _1 (BuiltinHead f :: a) = '[] :: [Hole]
type IsBuiltin uni (BuiltinHead f :: a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (BuiltinHead f :: a) = 'True

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.

Instances

Instances details
KnownTypeAst tyname uni y => KnownTypeAst tyname uni (LastArg x y :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

Associated Types

type IsBuiltin uni (LastArg x y :: Type) 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (LastArg x y :: Type) = IsBuiltin uni y

Methods

typeAst :: Type tyname uni () Source #

type ToBinds uni acc (LastArg x y :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds uni acc (LastArg x y :: Type) = ToBinds uni (ToBinds uni acc x) y
type ToHoles uni hole (LastArg x y :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles uni hole (LastArg x y :: Type) = '[RunHole hole x, RunHole hole y]
type IsBuiltin uni (LastArg x y :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (LastArg x y :: Type) = IsBuiltin uni y

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

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

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

Instances details
AllElaboratedArgs constr (ElaborateBuiltin uni x) => AllBuiltinArgs uni constr (x :: a) Source # 
Instance details

Defined in PlutusCore.Builtin.Polymorphism

operationalUnliftingError :: Text -> BuiltinError Source #

Construct a prism focusing on the *EvaluationFailure part of err by taking that *EvaluationFailure and

  1. pretty-printing and embedding it into an UnliftingError for the setter part of the prism
  2. returning it directly for the opposite direction (there's no other way to convert an UnliftingError to 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.

Instances

Instances details
Show (BuiltinRuntime (CkValue uni fun)) Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.Ck

Show (BuiltinRuntime (CekValue uni fun ann)) Source # 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

showsPrec :: Int -> BuiltinRuntime (CekValue uni fun ann) -> ShowS Source #

show :: BuiltinRuntime (CekValue uni fun ann) -> String Source #

showList :: [BuiltinRuntime (CekValue uni fun ann)] -> ShowS Source #

NFData (BuiltinRuntime val) Source # 
Instance details

Defined in PlutusCore.Builtin.Runtime

Methods

rnf :: BuiltinRuntime val -> () Source #

NoThunks (BuiltinRuntime val) Source # 
Instance details

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

Instances details
TestTypesFromTheUniverseAreAllKnown DefaultUni Source # 
Instance details

Defined in PlutusCore.Default.Universe

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 #

Feed the SingKind version of the given Kind to the given continuation.

bringKnownKind :: SingKind k -> (KnownKind k => r) -> r Source #

Satisfy the KnownKind constraint of a continuation using the given SingKind.

withKnownKind :: Kind ann -> (forall k. KnownKind k => Proxy 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

Instances details
type ToHoles DefaultUni _1 Void Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

type ToHoles DefaultUni _1 Void = '[] :: [Hole]
type ToHoles DefaultUni hole Int16 Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Int32 Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Int64 Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Int8 Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Word16 Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Word32 Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Word64 Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Word8 Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole ByteString Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Element Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Element Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole MlResult Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Data Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole DataNodeCount Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole IntegerCostedLiterally Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole NumBytesCostedAsNumWords Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole ValueMaxDepth Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole ValueTotalSize Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Value Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Text Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Integer Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Natural Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole () Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Bool Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Int Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole Word Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles DefaultUni hole (Vector a :: Type) Source # 
Instance details

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 # 
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles uni _1 (BuiltinResult a :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles uni _1 (BuiltinResult a :: Type) = '[TypeHole a :: Hole]
type ToHoles uni _1 (EvaluationResult a :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles uni _1 (EvaluationResult a :: Type) = '[TypeHole a :: Hole]
type ToHoles uni _1 (PlcListRep a :: Type) Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

type ToHoles uni _1 (PlcListRep a :: Type) = '[RepHole a :: Hole]
type ToHoles DefaultUni hole ((a, b) :: Type) Source # 
Instance details

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 # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles uni _1 (Opaque val rep :: Type) = '[RepHole rep :: Hole]
type ToHoles uni _1 (SomeConstant uni rep :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles uni _1 (SomeConstant uni rep :: Type) = '[RepHole rep :: Hole]
type ToHoles uni hole (LastArg x y :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles uni hole (LastArg x y :: Type) = '[RunHole hole x, RunHole hole y]
type ToHoles uni hole (a -> b :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles uni hole (a -> b :: Type) = '[RunHole hole a, RunHole hole b]
type ToHoles uni _1 (BuiltinHead f :: a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles uni _1 (BuiltinHead f :: a) = '[] :: [Hole]
type ToHoles uni _1 (TyVarRep name :: a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles uni _1 (TyVarRep name :: a) = '[] :: [Hole]
type ToHoles uni _1 (TyForallRep name a :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles uni _1 (TyForallRep name a :: Type) = '[RepHole a :: Hole]
type ToHoles uni _1 (MetaForall name a :: Type) Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

type ToHoles uni _1 (MetaForall name a :: Type) = '[TypeHole a :: Hole]
type ToHoles uni _1 (TyAppRep fun arg :: a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

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

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

Instances details
type ToBinds DefaultUni acc Void Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

type ToBinds DefaultUni acc Void = acc
type ToBinds DefaultUni acc Int16 Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Int32 Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Int64 Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Int8 Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Word16 Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Word32 Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Word64 Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Word8 Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc ByteString Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Element Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Element Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc MlResult Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Data Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc DataNodeCount Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc IntegerCostedLiterally Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc NumBytesCostedAsNumWords Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc ValueMaxDepth Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc ValueTotalSize Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Value Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Text Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Integer Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Natural Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc () Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Bool Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Int Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc Word Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds DefaultUni acc (Vector a :: Type) Source # 
Instance details

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 # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds uni acc (BuiltinResult a :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds uni acc (BuiltinResult a :: Type) = ToBinds uni acc a
type ToBinds uni acc (EvaluationResult a :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds uni acc (EvaluationResult a :: Type) = ToBinds uni acc a
type ToBinds uni acc (PlcListRep a :: Type) Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

type ToBinds uni acc (PlcListRep a :: Type) = ToBinds uni acc a
type ToBinds DefaultUni acc ((a, b) :: Type) Source # 
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds uni acc (LastArg x y :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds uni acc (LastArg x y :: Type) = ToBinds uni (ToBinds uni acc x) y
type ToBinds uni acc (Opaque val rep :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds uni acc (Opaque val rep :: Type) = ToBinds uni acc rep
type ToBinds uni acc (SomeConstant uni rep :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds uni acc (SomeConstant uni rep :: Type) = ToBinds uni acc rep
type ToBinds uni acc (a -> b :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds uni acc (a -> b :: Type) = ToBinds uni (ToBinds uni acc a) b
type ToBinds uni acc (BuiltinHead f :: a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds uni acc (BuiltinHead f :: a) = acc
type ToBinds uni acc (TyVarRep name :: a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds uni acc (TyVarRep name :: a) = Insert ('Some name) acc
type ToBinds uni acc (TyForallRep name a :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

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

Defined in PlutusCore.Examples.Builtins

type ToBinds uni acc (MetaForall name a :: Type) = ToBinds uni (Insert ('Some name) acc) a
type ToBinds uni acc (TyAppRep fun arg :: a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds uni acc (TyAppRep fun arg :: a) = ToBinds uni (ToBinds uni acc fun) arg

type family IsBuiltin (uni :: Type -> Type) (x :: a) :: Bool Source #

Whether x is a built-in type.

Instances

Instances details
type IsBuiltin DefaultUni Void Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

type IsBuiltin DefaultUni Int16 Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni Int32 Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni Int64 Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni Int8 Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni Word16 Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni Word32 Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni Word64 Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni Word8 Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni ByteString Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni Element Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni Element Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni MlResult Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni Data Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni DataNodeCount Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni IntegerCostedLiterally Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni NumBytesCostedAsNumWords Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni ValueMaxDepth Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni ValueTotalSize Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni Value Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni Text Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni Integer Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni Natural Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni () Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni Bool Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni Int Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni Word Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni (Vector a :: Type) Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin DefaultUni ([a] :: Type) Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin uni (BuiltinResult a :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (BuiltinResult a :: Type) = 'False
type IsBuiltin uni (EvaluationResult a :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (PlcListRep a :: Type) Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

type IsBuiltin uni (PlcListRep a :: Type) = 'False
type IsBuiltin DefaultUni ((a, b) :: Type) Source # 
Instance details

Defined in PlutusCore.Default.Universe

type IsBuiltin uni (LastArg x y :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (LastArg x y :: Type) = IsBuiltin uni y
type IsBuiltin uni (Opaque val rep :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

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

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (SomeConstant uni rep :: Type) = 'False
type IsBuiltin uni (a -> b :: Type) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (a -> b :: Type) = 'False
type IsBuiltin uni (BuiltinHead f :: a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (BuiltinHead f :: a) = 'True
type IsBuiltin uni (TyVarRep name :: a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

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

Defined in PlutusCore.Builtin.KnownTypeAst

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

Defined in PlutusCore.Examples.Builtins

type IsBuiltin uni (MetaForall name a :: Type) = 'False
type IsBuiltin uni (TyAppRep fun arg :: a) Source # 
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type IsBuiltin uni (TyAppRep fun arg :: a) = IsBuiltin uni fun && IsBuiltin uni arg

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

  1. the denotation of the builtin
  2. an uninstantiated costing function

Instances

Instances details
(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 # 
Instance details

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

  1. computing the PLC type of the function to be used during type checking
  2. getting arity information
  3. 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

Instances details
type CostingPart uni DefaultFun Source # 
Instance details

Defined in PlutusCore.Default.Builtins

type CostingPart uni ExtensionFun Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

type CostingPart uni (Either fun1 fun2) Source # 
Instance details

Defined in PlutusCore.Examples.Builtins

type CostingPart uni (Either fun1 fun2) = (CostingPart uni fun1, CostingPart uni fun2)

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.

Equations

GetArgs (a -> b) = a ': GetArgs b 
GetArgs _1 = '[] :: [Type] 

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

Instances details
(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 TypeSchemeResult/RuntimeSchemeResult.

Instance details

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 TypeSchemeArrow/RuntimeSchemeArrow.

Instance details

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

Instances details
KnownMonotype val args res => KnownPolytype ('[] :: [Some TyNameRep]) val args res Source #

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

Instance details

Defined in PlutusCore.Builtin.Meaning

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

Every type-level argument becomes a TypeSchemeAll.

Instance details

Defined in PlutusCore.Builtin.Meaning

type 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

Instances details
AnnotateCaseBuiltin DefaultUni Source # 
Instance details

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 

Fields

Instances

Instances details
CaseBuiltin uni => Default (CaserBuiltin uni) Source # 
Instance details

Defined in PlutusCore.Builtin.Case

Methods

def :: CaserBuiltin uni #

NFData (CaserBuiltin uni) Source # 
Instance details

Defined in PlutusCore.Builtin.Case

Methods

rnf :: CaserBuiltin uni -> () Source #

NoThunks (CaserBuiltin uni) Source # 
Instance details

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 #