| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Plutarch.FFI
Synopsis
- type family (p :: PType) >~< (t :: Type) :: Constraint where ...
- data PTxList (a :: PType) (s :: S)
- data PTxMaybe (a :: PType) (s :: S)
- = PTxJust (Term s a)
- | PTxNothing
- foreignExport :: forall p t. p >~< t => Config -> ClosedTerm p -> CompiledCode t
- foreignImport :: forall p t. p >~< t => CompiledCode t -> ClosedTerm p
- opaqueExport :: Config -> ClosedTerm p -> CompiledCode Void
- opaqueImport :: CompiledCode t -> ClosedTerm POpaque
- plistFromTx :: Term s (PTxList a :--> PList a)
- plistToTx :: Term s (PList a :--> PTxList a)
- pmaybeFromTx :: Term s (PTxMaybe a :--> PMaybe a)
- pmaybeToTx :: Term s (PMaybe a :--> PTxMaybe a)
- unsafeForeignExport :: Config -> ClosedTerm p -> CompiledCode t
- unsafeForeignImport :: CompiledCode t -> ClosedTerm p
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.
Instances
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
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.