plutarch-1.3.0
Safe HaskellSafe-Inferred
LanguageGHC2021

Plutarch.FFI

Synopsis

Documentation

type family (p :: PType) >~< (t :: Type) :: Constraint where ... Source #

Equality of inner types - Plutarch on the left and Haskell on the right.

Equations

PBool >~< BuiltinBool = () 
PInteger >~< Integer = () 
PString >~< BuiltinString = () 
PByteString >~< BuiltinByteString = () 
PData >~< BuiltinData = () 
PUnit >~< BuiltinUnit = () 
(a :--> b) >~< (a' -> b') = (a >~< a', b >~< b') 
(PTxList a) >~< [a'] = a >~< a' 
(PTxMaybe a) >~< (Maybe a') = a >~< a' 
(PDelayed p) >~< t = (DPTStrat p ~ PlutusTypeScott, G (PCode p) (TypeEncoding t)) 

data PTxList (a :: PType) (s :: S) Source #

Plutarch type of lists compatible with the PlutusTx encoding of Haskell lists and convertible with the regular PList using plistToTx and plistFromTx.

Constructors

PTxCons (Term s a) (Term s (PTxList a)) 
PTxNil 

Instances

Instances details
PListLike PTxList Source # 
Instance details

Defined in Plutarch.FFI

Associated Types

type PElemConstraint PTxList a Source #

Methods

pelimList :: forall (a :: PType) (s :: S) (r :: PType). PElemConstraint PTxList a => (Term s a -> Term s (PTxList a) -> Term s r) -> Term s r -> Term s (PTxList a) -> Term s r Source #

pcons :: forall (a :: PType) (s :: S). PElemConstraint PTxList a => Term s (a :--> (PTxList a :--> PTxList a)) Source #

pnil :: forall (a :: PType) (s :: S). PElemConstraint PTxList a => Term s (PTxList a) Source #

phead :: forall (a :: PType) (s :: S). PElemConstraint PTxList a => Term s (PTxList a :--> a) Source #

ptail :: forall (a :: PType) (s :: S). PElemConstraint PTxList a => Term s (PTxList a :--> PTxList a) Source #

pnull :: forall (a :: PType) (s :: S). PElemConstraint PTxList a => Term s (PTxList a :--> PBool) Source #

PEq a => PEq (PTxList a) Source # 
Instance details

Defined in Plutarch.FFI

Methods

(#==) :: forall (s :: S). Term s (PTxList a) -> Term s (PTxList a) -> Term s PBool Source #

PlutusType (PTxList a) Source # 
Instance details

Defined in Plutarch.FFI

Associated Types

type PInner (PTxList a) :: PType Source #

type PCovariant' (PTxList a) Source #

type PContravariant' (PTxList a) Source #

type PVariant' (PTxList a) Source #

Methods

pcon' :: forall (s :: S). PTxList a s -> Term s (PInner (PTxList a)) Source #

pmatch' :: forall (s :: S) (b :: PType). Term s (PInner (PTxList a)) -> (PTxList a s -> Term s b) -> Term s b Source #

PShow a => PShow (PTxList a) Source # 
Instance details

Defined in Plutarch.FFI

Methods

pshow' :: forall (s :: S). Bool -> Term s (PTxList a) -> Term s PString Source #

Generic (PTxList a s) Source # 
Instance details

Defined in Plutarch.FFI

Associated Types

type Rep (PTxList a s) :: Type -> Type Source #

Methods

from :: PTxList a s -> Rep (PTxList a s) x Source #

to :: Rep (PTxList a s) x -> PTxList a s Source #

Generic (PTxList a s) Source # 
Instance details

Defined in Plutarch.FFI

Associated Types

type Code (PTxList a s) :: [[Type]] Source #

Methods

from :: PTxList a s -> Rep (PTxList a s) Source #

to :: Rep (PTxList a s) -> PTxList a s Source #

HasDatatypeInfo (PTxList a s) Source # 
Instance details

Defined in Plutarch.FFI

Associated Types

type DatatypeInfoOf (PTxList a s) :: DatatypeInfo Source #

Methods

datatypeInfo :: proxy (PTxList a s) -> DatatypeInfo (Code (PTxList a s)) Source #

type PElemConstraint PTxList _1 Source # 
Instance details

Defined in Plutarch.FFI

type PContravariant' (PTxList a) Source # 
Instance details

Defined in Plutarch.FFI

type PCovariant' (PTxList a) Source # 
Instance details

Defined in Plutarch.FFI

type PInner (PTxList a) Source # 
Instance details

Defined in Plutarch.FFI

type PInner (PTxList a)
type PVariant' (PTxList a) Source # 
Instance details

Defined in Plutarch.FFI

type Rep (PTxList a s) Source # 
Instance details

Defined in Plutarch.FFI

type Rep (PTxList a s) = D1 ('MetaData "PTxList" "Plutarch.FFI" "plutarch-1.3.0-287WdR4V4qr3NTh5i3Je4I" 'False) (C1 ('MetaCons "PTxCons" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s (PTxList a)))) :+: C1 ('MetaCons "PTxNil" 'PrefixI 'False) (U1 :: Type -> Type))
type Code (PTxList a s) Source # 
Instance details

Defined in Plutarch.FFI

type Code (PTxList a s) = GCode (PTxList a s)
type DatatypeInfoOf (PTxList a s) Source # 
Instance details

Defined in Plutarch.FFI

data PTxMaybe (a :: PType) (s :: S) Source #

Plutarch type compatible with the PlutusTx encoding of Haskell Maybe and convertible with the regular PMaybe using pmaybeToTx and pmaybeFromTx.

Constructors

PTxJust (Term s a) 
PTxNothing 

Instances

Instances details
PEq a => PEq (PTxMaybe a) Source # 
Instance details

Defined in Plutarch.FFI

Methods

(#==) :: forall (s :: S). Term s (PTxMaybe a) -> Term s (PTxMaybe a) -> Term s PBool Source #

PlutusType (PTxMaybe a) Source # 
Instance details

Defined in Plutarch.FFI

Methods

pcon' :: forall (s :: S). PTxMaybe a s -> Term s (PInner (PTxMaybe a)) Source #

pmatch' :: forall (s :: S) (b :: PType). Term s (PInner (PTxMaybe a)) -> (PTxMaybe a s -> Term s b) -> Term s b Source #

PShow a => PShow (PTxMaybe a) Source # 
Instance details

Defined in Plutarch.FFI

Methods

pshow' :: forall (s :: S). Bool -> Term s (PTxMaybe a) -> Term s PString Source #

Generic (PTxMaybe a s) Source # 
Instance details

Defined in Plutarch.FFI

Associated Types

type Rep (PTxMaybe a s) :: Type -> Type Source #

Methods

from :: PTxMaybe a s -> Rep (PTxMaybe a s) x Source #

to :: Rep (PTxMaybe a s) x -> PTxMaybe a s Source #

Generic (PTxMaybe a s) Source # 
Instance details

Defined in Plutarch.FFI

Associated Types

type Code (PTxMaybe a s) :: [[Type]] Source #

Methods

from :: PTxMaybe a s -> Rep (PTxMaybe a s) Source #

to :: Rep (PTxMaybe a s) -> PTxMaybe a s Source #

HasDatatypeInfo (PTxMaybe a s) Source # 
Instance details

Defined in Plutarch.FFI

Associated Types

type DatatypeInfoOf (PTxMaybe a s) :: DatatypeInfo Source #

Methods

datatypeInfo :: proxy (PTxMaybe a s) -> DatatypeInfo (Code (PTxMaybe a s)) Source #

type PContravariant' (PTxMaybe a) Source # 
Instance details

Defined in Plutarch.FFI

type PCovariant' (PTxMaybe a) Source # 
Instance details

Defined in Plutarch.FFI

type PInner (PTxMaybe a) Source # 
Instance details

Defined in Plutarch.FFI

type PInner (PTxMaybe a)
type PVariant' (PTxMaybe a) Source # 
Instance details

Defined in Plutarch.FFI

type Rep (PTxMaybe a s) Source # 
Instance details

Defined in Plutarch.FFI

type Rep (PTxMaybe a s) = D1 ('MetaData "PTxMaybe" "Plutarch.FFI" "plutarch-1.3.0-287WdR4V4qr3NTh5i3Je4I" 'False) (C1 ('MetaCons "PTxJust" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s a))) :+: C1 ('MetaCons "PTxNothing" 'PrefixI 'False) (U1 :: Type -> Type))
type Code (PTxMaybe a s) Source # 
Instance details

Defined in Plutarch.FFI

type Code (PTxMaybe a s) = GCode (PTxMaybe a s)
type DatatypeInfoOf (PTxMaybe a s) Source # 
Instance details

Defined in Plutarch.FFI

foreignExport :: forall p t. p >~< t => Config -> ClosedTerm p -> CompiledCode t Source #

Compile and export a Plutarch term so it can be used by applyCode.

foreignImport :: forall p t. p >~< t => CompiledCode t -> ClosedTerm p Source #

Import compiled UPLC code (such as a spliced compile result) as a Plutarch term.

opaqueExport :: Config -> ClosedTerm p -> CompiledCode Void Source #

Export Plutarch term of any type as CompiledCode Void.

opaqueImport :: CompiledCode t -> ClosedTerm POpaque Source #

Import compiled UPLC code of any type as a Plutarch opaque term.

plistFromTx :: Term s (PTxList a :--> PList a) Source #

Convert a PTxList to a PList, probably after importing it with foreignImport.

plistToTx :: Term s (PList a :--> PTxList a) Source #

Convert a PList to a PTxList, perhaps before exporting it with foreignExport.

pmaybeFromTx :: Term s (PTxMaybe a :--> PMaybe a) Source #

Convert a PTxMaybe to a PMaybe, probably after importing it with foreignImport.

pmaybeToTx :: Term s (PMaybe a :--> PTxMaybe a) Source #

Convert a PMaybe to a PTxMaybe, perhaps before exporting it with foreignExport.

unsafeForeignExport :: Config -> ClosedTerm p -> CompiledCode t Source #

Seriously unsafe, may fail at run time or result in unexpected behaviour in your on-chain validator.

unsafeForeignImport :: CompiledCode t -> ClosedTerm p Source #

Seriously unsafe, may fail at run time or result in unexpected behaviour in your on-chain validator.