plutus-tx-1.0.0.0: Libraries for Plutus Tx and its prelude
Safe Haskell None
Language Haskell2010

PlutusTx

Synopsis

Documentation

type CompiledCode = CompiledCodeIn DefaultUni DefaultFun Source #

CompiledCodeIn instantiated with default built-in types and functions.

data CompiledCodeIn uni fun a Source #

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.

getPir :: ( Closed uni, uni `Everywhere` Flat , Flat fun) => CompiledCodeIn uni fun a -> Maybe ( Program TyName Name uni fun ()) Source #

Get the Plutus IR program, if there is one, out of a CompiledCodeIn .

applyCode :: ( Closed uni, uni `Everywhere` Flat , Flat fun, uni `Everywhere` PrettyConst , GShow uni, Pretty fun) => CompiledCodeIn uni fun (a -> b) -> CompiledCodeIn uni fun a -> CompiledCodeIn uni fun b Source #

Apply a compiled function to a compiled argument.

data BuiltinData Source #

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

Instances details
Eq BuiltinData Source #
Instance details

Defined in PlutusTx.Builtins.Internal

Data BuiltinData Source #
Instance details

Defined in PlutusTx.Builtins.Internal

Methods

gfoldl :: ( forall d b. Data d => c (d -> b) -> d -> c b) -> ( forall g. g -> c g) -> BuiltinData -> c BuiltinData Source #

gunfold :: ( forall b r. Data b => c (b -> r) -> c r) -> ( forall r. r -> c r) -> Constr -> c BuiltinData Source #

toConstr :: BuiltinData -> Constr Source #

dataTypeOf :: BuiltinData -> DataType Source #

dataCast1 :: Typeable t => ( forall d. Data d => c (t d)) -> Maybe (c BuiltinData ) Source #

dataCast2 :: Typeable t => ( forall d e. ( Data d, Data e) => c (t d e)) -> Maybe (c BuiltinData ) Source #

gmapT :: ( forall b. Data b => b -> b) -> BuiltinData -> BuiltinData Source #

gmapQl :: (r -> r' -> r) -> r -> ( forall d. Data d => d -> r') -> BuiltinData -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> ( forall d. Data d => d -> r') -> BuiltinData -> r Source #

gmapQ :: ( forall d. Data d => d -> u) -> BuiltinData -> [u] Source #

gmapQi :: Int -> ( forall d. Data d => d -> u) -> BuiltinData -> u Source #

gmapM :: Monad m => ( forall d. Data d => d -> m d) -> BuiltinData -> m BuiltinData Source #

gmapMp :: MonadPlus m => ( forall d. Data d => d -> m d) -> BuiltinData -> m BuiltinData Source #

gmapMo :: MonadPlus m => ( forall d. Data d => d -> m d) -> BuiltinData -> m BuiltinData Source #

Ord BuiltinData Source #
Instance details

Defined in PlutusTx.Builtins.Internal

Show BuiltinData Source #
Instance details

Defined in PlutusTx.Builtins.Internal

NFData BuiltinData Source #
Instance details

Defined in PlutusTx.Builtins.Internal

Pretty BuiltinData Source #
Instance details

Defined in PlutusTx.Builtins.Internal

Eq BuiltinData Source #
Instance details

Defined in PlutusTx.Eq

UnsafeFromData BuiltinData Source #
Instance details

Defined in PlutusTx.IsData.Class

FromData BuiltinData Source #
Instance details

Defined in PlutusTx.IsData.Class

ToData BuiltinData Source #
Instance details

Defined in PlutusTx.IsData.Class

Includes uni Data => Lift uni BuiltinData Source #
Instance details

Defined in PlutusTx.Lift.Instances

ToBuiltin BuiltinData BuiltinData Source #
Instance details

Defined in PlutusTx.Builtins.Class

FromBuiltin BuiltinData BuiltinData Source #
Instance details

Defined in PlutusTx.Builtins.Class

Includes uni Data => Typeable uni BuiltinData Source #
Instance details

Defined in PlutusTx.Lift.Instances

ToBuiltin [( BuiltinData , BuiltinData )] ( BuiltinList ( BuiltinPair BuiltinData BuiltinData )) Source #
Instance details

Defined in PlutusTx.Builtins.Class

ToBuiltin [ BuiltinData ] ( BuiltinList BuiltinData ) Source #
Instance details

Defined in PlutusTx.Builtins.Class

ToBuiltin ( BuiltinData , BuiltinData ) ( BuiltinPair BuiltinData BuiltinData ) Source #
Instance details

Defined in PlutusTx.Builtins.Class

data Data Source #

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 i th constructor along with its arguments.

The other constructors are various primitives.

Instances

Instances details
Eq Data
Instance details

Defined in PlutusCore.Data

Data Data
Instance details

Defined in PlutusCore.Data

Methods

gfoldl :: ( forall d b. Data0 d => c (d -> b) -> d -> c b) -> ( forall g. g -> c g) -> Data -> c Data Source #

gunfold :: ( forall b r. Data0 b => c (b -> r) -> c r) -> ( forall r. r -> c r) -> Constr -> c Data Source #

toConstr :: Data -> Constr Source #

dataTypeOf :: Data -> DataType Source #

dataCast1 :: Typeable t => ( forall d. Data0 d => c (t d)) -> Maybe (c Data ) Source #

dataCast2 :: Typeable t => ( forall d e. ( Data0 d, Data0 e) => c (t d e)) -> Maybe (c Data ) Source #

gmapT :: ( forall b. Data0 b => b -> b) -> Data -> Data Source #

gmapQl :: (r -> r' -> r) -> r -> ( forall d. Data0 d => d -> r') -> Data -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> ( forall d. Data0 d => d -> r') -> Data -> r Source #

gmapQ :: ( forall d. Data0 d => d -> u) -> Data -> [u] Source #

gmapQi :: Int -> ( forall d. Data0 d => d -> u) -> Data -> u Source #

gmapM :: Monad m => ( forall d. Data0 d => d -> m d) -> Data -> m Data Source #

gmapMp :: MonadPlus m => ( forall d. Data0 d => d -> m d) -> Data -> m Data Source #

gmapMo :: MonadPlus m => ( forall d. Data0 d => d -> m d) -> Data -> m Data Source #

Ord Data
Instance details

Defined in PlutusCore.Data

Show Data
Instance details

Defined in PlutusCore.Data

Generic Data
Instance details

Defined in PlutusCore.Data

Associated Types

type Rep Data :: Type -> Type Source #

NFData Data
Instance details

Defined in PlutusCore.Data

ExMemoryUsage Data
Instance details

Defined in PlutusCore.Evaluation.Machine.ExMemory

Pretty Data
Instance details

Defined in PlutusCore.Data

Serialise Data
Instance details

Defined in PlutusCore.Data

PrettyBy ConstConfig Data
Instance details

Defined in PlutusCore.Pretty.PrettyConst

Lift DefaultUni Data Source #
Instance details

Defined in PlutusTx.Lift.Instances

HasConstantIn DefaultUni term => MakeKnownIn DefaultUni term Data
Instance details

Defined in PlutusCore.Default.Universe

HasConstantIn DefaultUni term => ReadKnownIn DefaultUni term Data
Instance details

Defined in PlutusCore.Default.Universe

KnownBuiltinTypeAst DefaultUni Data => KnownTypeAst DefaultUni Data
Instance details

Defined in PlutusCore.Default.Universe

Contains DefaultUni Data
Instance details

Defined in PlutusCore.Default.Universe

Typeable DefaultUni Data Source #
Instance details

Defined in PlutusTx.Lift.Instances

type Rep Data
Instance details

Defined in PlutusCore.Data

type ToBinds Data
Instance details

Defined in PlutusCore.Default.Universe

type ToBinds Data = ToBinds (ElaborateBuiltin Data )
type ToHoles Data
Instance details

Defined in PlutusCore.Default.Universe

type ToHoles Data = ToHoles (ElaborateBuiltin Data )

class ToData (a :: Type ) where Source #

A typeclass for types that can be converted to and from BuiltinData .

Instances

Instances details
ToData Bool Source #
Instance details

Defined in PlutusTx.IsData.Instances

( TypeError (' Text "Int is not supported, use Integer instead") :: Constraint ) => ToData Int Source #
Instance details

Defined in PlutusTx.IsData.Class

ToData Integer Source #
Instance details

Defined in PlutusTx.IsData.Class

ToData () Source #
Instance details

Defined in PlutusTx.IsData.Instances

ToData Void Source #
Instance details

Defined in PlutusTx.IsData.Class

ToData BuiltinData Source #
Instance details

Defined in PlutusTx.IsData.Class

ToData BuiltinByteString Source #
Instance details

Defined in PlutusTx.IsData.Class

ToData Rational Source #
Instance details

Defined in PlutusTx.Ratio

ToData Sqrt Source #
Instance details

Defined in PlutusTx.Sqrt

ToData a => ToData [a] Source #
Instance details

Defined in PlutusTx.IsData.Class

ToData a => ToData ( Maybe a) Source #
Instance details

Defined in PlutusTx.IsData.Instances

( ToData a, ToData b) => ToData ( Either a b) Source #
Instance details

Defined in PlutusTx.IsData.Instances

( ToData a, ToData b) => ToData (a, b) Source #
Instance details

Defined in PlutusTx.IsData.Instances

( ToData k, ToData v) => ToData ( Map k v) Source #
Instance details

Defined in PlutusTx.AssocMap

( ToData a, ToData b, ToData c) => ToData (a, b, c) Source #
Instance details

Defined in PlutusTx.IsData.Instances

( ToData a, ToData b, ToData c, ToData d) => ToData (a, b, c, d) Source #
Instance details

Defined in PlutusTx.IsData.Instances

class FromData (a :: Type ) where Source #

Methods

fromBuiltinData :: BuiltinData -> Maybe a Source #

Convert a value from BuiltinData , returning Nothing if this fails.

Instances

Instances details
FromData Bool Source #
Instance details

Defined in PlutusTx.IsData.Instances

( TypeError (' Text "Int is not supported, use Integer instead") :: Constraint ) => FromData Int Source #
Instance details

Defined in PlutusTx.IsData.Class

FromData Integer Source #
Instance details

Defined in PlutusTx.IsData.Class

FromData () Source #
Instance details

Defined in PlutusTx.IsData.Instances

FromData Void Source #
Instance details

Defined in PlutusTx.IsData.Class

FromData BuiltinData Source #
Instance details

Defined in PlutusTx.IsData.Class

FromData BuiltinByteString Source #
Instance details

Defined in PlutusTx.IsData.Class

FromData Rational Source #
Instance details

Defined in PlutusTx.Ratio

FromData Sqrt Source #
Instance details

Defined in PlutusTx.Sqrt

FromData a => FromData [a] Source #
Instance details

Defined in PlutusTx.IsData.Class

FromData a => FromData ( Maybe a) Source #
Instance details

Defined in PlutusTx.IsData.Instances

( FromData a, FromData b) => FromData ( Either a b) Source #
Instance details

Defined in PlutusTx.IsData.Instances

( FromData a, FromData b) => FromData (a, b) Source #
Instance details

Defined in PlutusTx.IsData.Instances

( FromData k, FromData v) => FromData ( Map k v) Source #
Instance details

Defined in PlutusTx.AssocMap

( FromData a, FromData b, FromData c) => FromData (a, b, c) Source #
Instance details

Defined in PlutusTx.IsData.Instances

( FromData a, FromData b, FromData c, FromData d) => FromData (a, b, c, d) Source #
Instance details

Defined in PlutusTx.IsData.Instances

class UnsafeFromData (a :: Type ) where Source #

Methods

unsafeFromBuiltinData :: BuiltinData -> a Source #

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!

Instances

Instances details
UnsafeFromData Bool Source #
Instance details

Defined in PlutusTx.IsData.Instances

( TypeError (' Text "Int is not supported, use Integer instead") :: Constraint ) => UnsafeFromData Int Source #
Instance details

Defined in PlutusTx.IsData.Class

UnsafeFromData Integer Source #
Instance details

Defined in PlutusTx.IsData.Class

UnsafeFromData () Source #
Instance details

Defined in PlutusTx.IsData.Instances

UnsafeFromData Void Source #
Instance details

Defined in PlutusTx.IsData.Class

UnsafeFromData BuiltinData Source #
Instance details

Defined in PlutusTx.IsData.Class

UnsafeFromData BuiltinByteString Source #
Instance details

Defined in PlutusTx.IsData.Class

UnsafeFromData Rational Source #
Instance details

Defined in PlutusTx.Ratio

UnsafeFromData Sqrt Source #
Instance details

Defined in PlutusTx.Sqrt

UnsafeFromData a => UnsafeFromData [a] Source #
Instance details

Defined in PlutusTx.IsData.Class

UnsafeFromData a => UnsafeFromData ( Maybe a) Source #
Instance details

Defined in PlutusTx.IsData.Instances

( UnsafeFromData a, UnsafeFromData b) => UnsafeFromData ( Either a b) Source #
Instance details

Defined in PlutusTx.IsData.Instances

( UnsafeFromData a, UnsafeFromData b) => UnsafeFromData (a, b) Source #
Instance details

Defined in PlutusTx.IsData.Instances

( UnsafeFromData k, UnsafeFromData v) => UnsafeFromData ( Map k v) Source #
Instance details

Defined in PlutusTx.AssocMap

( UnsafeFromData a, UnsafeFromData b, UnsafeFromData c) => UnsafeFromData (a, b, c) Source #
Instance details

Defined in PlutusTx.IsData.Instances

( UnsafeFromData a, UnsafeFromData b, UnsafeFromData c, UnsafeFromData d) => UnsafeFromData (a, b, c, d) Source #
Instance details

Defined in PlutusTx.IsData.Instances

toData :: ToData a => a -> Data Source #

Convert a value to Data .

fromData :: FromData a => Data -> Maybe a Source #

Convert a value from Data , returning Nothing if this fails.

unstableMakeIsData :: Name -> Q [ Dec ] Source #

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 ] Source #

Generate a FromData and a ToData instance for a type, using an explicit mapping of constructor names to indices. Use this for types where you need to keep the representation stable.

class Lift uni a Source #

Class for types which can be lifted into Plutus IR. Instances should be derived, do not write your own instance!

Minimal complete definition

lift

Instances

Instances details
Includes uni Text => Lift uni BuiltinString Source #
Instance details

Defined in PlutusTx.Lift.Instances

Includes uni ByteString => Lift uni BuiltinByteString Source #
Instance details

Defined in PlutusTx.Lift.Instances

Includes uni Data => Lift uni BuiltinData Source #
Instance details

Defined in PlutusTx.Lift.Instances

Includes uni ByteString => Lift uni ByteString Source #
Instance details

Defined in PlutusTx.Lift.Instances

Includes uni Integer => Lift uni Integer Source #
Instance details

Defined in PlutusTx.Lift.Instances

( TypeError (' Text "Int is not supported, use Integer instead") :: Constraint ) => Lift uni Int Source #
Instance details

Defined in PlutusTx.Lift.Instances

Lift DefaultUni Bool Source #
Instance details

Defined in PlutusTx.Lift.Instances

Lift DefaultUni () Source #
Instance details

Defined in PlutusTx.Lift.Instances

Lift DefaultUni Data Source #
Instance details

Defined in PlutusTx.Lift.Instances

Lift DefaultUni Rational Source #
Instance details

Defined in PlutusTx.Ratio

Lift DefaultUni Sqrt Source #
Instance details

Defined in PlutusTx.Sqrt

( FromBuiltin arep a, Includes uni [a]) => Lift uni ( BuiltinList arep) Source #
Instance details

Defined in PlutusTx.Lift.Instances

( Typeable DefaultUni a, Lift DefaultUni a) => Lift DefaultUni [a] Source #
Instance details

Defined in PlutusTx.Lift.Instances

( Typeable DefaultUni a, Lift DefaultUni a) => Lift DefaultUni ( Maybe a) Source #
Instance details

Defined in PlutusTx.Lift.Instances

( Typeable DefaultUni a, Typeable DefaultUni b, Lift DefaultUni a, Lift DefaultUni b) => Lift DefaultUni ( Either a b) Source #
Instance details

Defined in PlutusTx.Lift.Instances

( Typeable DefaultUni a, Typeable DefaultUni b, Lift DefaultUni a, Lift DefaultUni b) => Lift DefaultUni (a, b) Source #
Instance details

Defined in PlutusTx.Lift.Instances

Lift DefaultUni [(k, v)] => Lift DefaultUni ( Map k v) Source #
Instance details

Defined in PlutusTx.AssocMap

( Typeable DefaultUni a, Typeable DefaultUni b, Typeable DefaultUni c, Lift DefaultUni a, Lift DefaultUni b, Lift DefaultUni c) => Lift DefaultUni (a, b, c) Source #
Instance details

Defined in PlutusTx.Lift.Instances

( Typeable DefaultUni a, Typeable DefaultUni b, Typeable DefaultUni c, Typeable DefaultUni d, Lift DefaultUni a, Lift DefaultUni b, Lift DefaultUni c, Lift DefaultUni d) => Lift DefaultUni (a, b, c, d) Source #
Instance details

Defined in PlutusTx.Lift.Instances

( Typeable DefaultUni a, Typeable DefaultUni b, Typeable DefaultUni c, Typeable DefaultUni d, Typeable DefaultUni e, Lift DefaultUni a, Lift DefaultUni b, Lift DefaultUni c, Lift DefaultUni d, Lift DefaultUni e) => Lift DefaultUni (a, b, c, d, e) Source #
Instance details

Defined in PlutusTx.Lift.Instances

class Typeable uni (a :: k) Source #

Class for types which have a corresponding Plutus IR type. Instances should always be derived, do not write your own instance!

Minimal complete definition

typeRep

Instances

Instances details
( Typeable uni f, Typeable uni a) => Typeable uni (f a :: k) Source #
Instance details

Defined in PlutusTx.Lift.Instances

Includes uni Text => Typeable uni BuiltinString Source #
Instance details

Defined in PlutusTx.Lift.Instances

Includes uni ByteString => Typeable uni BuiltinByteString Source #
Instance details

Defined in PlutusTx.Lift.Instances

Includes uni Data => Typeable uni BuiltinData Source #
Instance details

Defined in PlutusTx.Lift.Instances

Includes uni ByteString => Typeable uni ByteString Source #
Instance details

Defined in PlutusTx.Lift.Instances

Includes uni Integer => Typeable uni Integer Source #
Instance details

Defined in PlutusTx.Lift.Instances

( TypeError (' Text "Int is not supported, use Integer instead") :: Constraint ) => Typeable uni Int Source #
Instance details

Defined in PlutusTx.Lift.Instances

Typeable DefaultUni Bool Source #
Instance details

Defined in PlutusTx.Lift.Instances

Typeable DefaultUni () Source #
Instance details

Defined in PlutusTx.Lift.Instances

Typeable DefaultUni Data Source #
Instance details

Defined in PlutusTx.Lift.Instances

Typeable DefaultUni Rational Source #
Instance details

Defined in PlutusTx.Ratio

Typeable DefaultUni Sqrt Source #
Instance details

Defined in PlutusTx.Sqrt

Typeable DefaultUni (,,,,) Source #
Instance details

Defined in PlutusTx.Lift.Instances

Typeable DefaultUni (,,,) Source #
Instance details

Defined in PlutusTx.Lift.Instances

Typeable DefaultUni (,,) Source #
Instance details

Defined in PlutusTx.Lift.Instances

Typeable DefaultUni Either Source #
Instance details

Defined in PlutusTx.Lift.Instances

Typeable DefaultUni (,) Source #
Instance details

Defined in PlutusTx.Lift.Instances

Typeable DefaultUni Map Source #
Instance details

Defined in PlutusTx.AssocMap

Typeable DefaultUni [] Source #
Instance details

Defined in PlutusTx.Lift.Instances

Typeable DefaultUni Maybe Source #
Instance details

Defined in PlutusTx.Lift.Instances

Typeable uni ((->) :: Type -> Type -> Type ) Source #
Instance details

Defined in PlutusTx.Lift.Instances

liftCode :: ( Lift uni a, Throwable uni fun, Typecheckable uni fun) => a -> CompiledCodeIn uni fun a Source #

Get a Plutus Core program corresponding to the given value as a CompiledCodeIn , throwing any errors that occur as exceptions and ignoring fresh names.