| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
PlutusTx
Synopsis
- module PlutusTx.TH
- type CompiledCode = CompiledCodeIn DefaultFun #
CompiledCodeIninstantiated with default built-in types and functions.
data CompiledCodeIn uni fun a #
A compiled Plutus Tx program. The last type parameter indicates the type of the Haskell expression that was compiled, and hence the type of the compiled code.
Note: the compiled PLC program does *not* have normalized types, if you want to put it on the chain you must normalize the types first.
getPlc :: (SomeTypeIn uni)) => CompiledCodeIn uni fun (a -> b) -> CompiledCodeIn uni fun a -> CompiledCodeIn uni fun b #
Apply a compiled function to a compiled argument. Will throw if the versions don't match, should only be used in non-production code.
data BuiltinData #
A type corresponding to the Plutus Core builtin equivalent of Data.
The point of this type is to be an opaque equivalent of Data, so as to
ensure that it is only used in ways that the compiler can handle.
As such, you should use this type in your on-chain code, and in any data structures that you want to be representable on-chain.
For off-chain usage, there are conversion functions builtinDataToData and
dataToBuiltinData, but note that these will not work on-chain.
Instances
| TyName uni ()) # | |
| HasToOpaque (BuiltinData, BuiltinData) (BuiltinPair BuiltinData BuiltinData) # | |
Defined in PlutusTx.Builtins.HasOpaque Methods toOpaque :: (BuiltinData, BuiltinData) -> BuiltinPair BuiltinData BuiltinData # | |
| type Rep BuiltinData # | |
Defined in PlutusTx.Builtins.Internal type Rep BuiltinData = D1 ('MetaData "BuiltinData" "PlutusTx.Builtins.Internal" "plutus-tx-1.60.0.0-inplace" 'False) (C1 ('MetaCons "BuiltinData" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceLazy 'DecidedLazy) (Rec0 Data))) | |
| type Unroll BuiltinData # | |
Defined in PlutusTx.Blueprint.Definition.Unroll | |
| type FromBuiltin BuiltinData # | |
Defined in PlutusTx.Builtins.HasBuiltin | |
A generic "data" type.
The main constructor Constr represents a datatype value in sum-of-products
form: Constr i args represents a use of the ith constructor along with its arguments.
The other constructors are various primitives.
class ToData (a :: Type) where #
A typeclass for types that can be converted to and from BuiltinData.
Instances
| ToData Void # | |
Defined in PlutusTx.IsData.Class Methods toBuiltinData :: Void -> BuiltinData # | |
| ToData BuiltinBLS12_381_G1_Element # | For the BLS12-381 G1 and G2 types we use the |
Defined in PlutusTx.IsData.Class Methods toBuiltinData :: BuiltinBLS12_381_G1_Element -> BuiltinData # | |
| ToData BuiltinBLS12_381_G2_Element # | |
Defined in PlutusTx.IsData.Class Methods toBuiltinData :: BuiltinBLS12_381_G2_Element -> BuiltinData # | |
| (TypeError ('Text "toBuiltinData is not supported for BuiltinBLS12_381_MlResult") :: Constraint) => ToData BuiltinBLS12_381_MlResult # | We do not provide instances of any of these classes for BuiltinBLS12_381_MlResult since there is no serialisation format: we expect that values of that type will only occur as the result of on-chain computations. |
Defined in PlutusTx.IsData.Class Methods | |
| ToData BuiltinByteString # | |
Defined in PlutusTx.IsData.Class Methods | |
| ToData BuiltinData # | |
Defined in PlutusTx.IsData.Class Methods toBuiltinData :: BuiltinData -> BuiltinData # | |
| ToData Rational # | |
Defined in PlutusTx.Ratio Methods toBuiltinData :: Rational -> BuiltinData # | |
| ToData Sqrt # | |
Defined in PlutusTx.Sqrt Methods toBuiltinData :: Sqrt -> BuiltinData # | |
| ToData Integer # | |
Defined in PlutusTx.IsData.Class Methods toBuiltinData :: Integer -> BuiltinData # | |
| ToData () # | |
Defined in PlutusTx.IsData.Instances Methods toBuiltinData :: () -> BuiltinData # | |
| ToData Bool # | |
Defined in PlutusTx.IsData.Instances Methods toBuiltinData :: Bool -> BuiltinData # | |
| (TypeError ('Text "Int is not supported, use Integer instead") :: Constraint) => ToData Int # | |
Defined in PlutusTx.IsData.Class Methods toBuiltinData :: Int -> BuiltinData # | |
| ToData (List a) # | |
Defined in PlutusTx.Data.List Methods toBuiltinData :: List a -> BuiltinData # | |
| ToData a => ToData (Maybe a) # | |
Defined in PlutusTx.IsData.Instances Methods toBuiltinData :: Maybe a -> BuiltinData # | |
| ToData a => ToData [a] # | |
Defined in PlutusTx.IsData.Class Methods toBuiltinData :: [a] -> BuiltinData # | |
| (ToData a, ToData b) => ToData (Either a b) # | |
Defined in PlutusTx.IsData.Instances Methods toBuiltinData :: Either a b -> BuiltinData # | |
| (ToData k, ToData v) => ToData (Map k v) # | Hand-written instances to use the underlying |
Defined in PlutusTx.AssocMap Methods toBuiltinData :: Map k v -> BuiltinData # | |
| ToData (Map k a) # | |
Defined in PlutusTx.Data.AssocMap Methods toBuiltinData :: Map k a -> BuiltinData # | |
| (ToData a, ToData b) => ToData (These a b) # | |
Defined in PlutusTx.These Methods toBuiltinData :: These a b -> BuiltinData # | |
| (ToData a, ToData b) => ToData (a, b) # | |
Defined in PlutusTx.IsData.Instances Methods toBuiltinData :: (a, b) -> BuiltinData # | |
| (ToData a, ToData b, ToData c) => ToData (a, b, c) # | |
Defined in PlutusTx.IsData.Instances Methods toBuiltinData :: (a, b, c) -> BuiltinData # | |
| (ToData a, ToData b, ToData c, ToData d) => ToData (a, b, c, d) # | |
Defined in PlutusTx.IsData.Instances Methods toBuiltinData :: (a, b, c, d) -> BuiltinData # | |
class FromData (a :: Type) where #
Methods
fromBuiltinData :: BuiltinData -> Maybe a #
Convert a value from BuiltinData, returning Nothing if this fails.
Instances
class UnsafeFromData (a :: Type) where #
Methods
unsafeFromBuiltinData :: BuiltinData -> a #
Convert a value from BuiltinData, calling error if this fails.
This is typically much faster than fromBuiltinData.
When implementing this function, make sure to call unsafeFromBuiltinData
rather than fromBuiltinData when converting substructures!
This is a simple type without any validation, use with caution.
Instances
builtinDataToData :: BuiltinData -> Data #
NOT a builtin. Converts a BuiltinData into a Data. Only works off-chain.
dataToBuiltinData :: Data -> BuiltinData #
NOT a builtin. Converts a Data into a BuiltinData. Only works off-chain.
unstableMakeIsData :: Name -> Q [Dec] #
Generate a FromData and a ToData instance for a type.
This may not be stable in the face of constructor additions,
renamings, etc. Use makeIsDataIndexed if you need stability.
makeIsDataIndexed :: Name -> [(Name, Int)] -> Q [Dec] #
Generate a ToData, 'FromData and a UnsafeFromData instances for a type,
using an explicit mapping of constructor names to indices.
Use this for types where you need to keep the representation stable.
makeIsDataSchemaIndexed :: Name -> [(Name, Natural)] -> Q [InstanceDec] #
Generate a ToData, FromData, UnsafeFromData, HasBlueprintSchema instances for a type,
using an explicit mapping of constructor names to indices.
Use this for types where you need to keep the representation stable.
Note: Requires ViewPatterns, FlexibleInstances, UndecidableInstances, MultiParamTypeClasses, TypeApplications language extensions and an `import PlutusTx.Blueprint.Definition (definitionRef)`.
Class for types which can be lifted into Plutus IR. Instances should be derived, do not write your own instance!
Minimal complete definition
Instances
| Lift DefaultUni fun ()) # |
Class for types which have a corresponding Plutus IR type. Instances should always be derived, do not write your own instance!
Minimal complete definition
Instances
| Typeable RewriteRules uni fun), Hashable fun) => a -> CompiledCodeIn uni fun a # Get a Plutus Core program with the default version, corresponding to the given value as a |