Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Documentation
printTerm :: HasCallStack => Config -> ClosedTerm a -> String Source #
Prettyprint a Term via the PLC pretty printer
TODO: Heavily improve. It's unreadable right now.
We could convert the de Bruijn indices into names with:
show . prettyPlcReadableDef . (\(Right p) -> p) . Scripts.mkTermToEvaluate . compile $ term
printScript :: Script -> String Source #
Prettyprint a compiled Script via the PLC pretty printer
pto :: Term s a -> Term s (PInner a) Source #
Safely coerce from a Term to it's PInner
representation.
pfix :: Term s (((a :--> b) :--> (a :--> b)) :--> (a :--> b)) Source #
Fixpoint recursion. Used to encode recursive functions.
Example:
iterateN' :: Term s (PInteger :--> (a :--> a) :--> a :--> a) -> Term s PInteger -> Term s (a :--> a) -> Term s a iterateN' self n f x = pif (n #== 0) x (self # n - 1 #$ f x) iterateN :: Term s (PInteger :--> (a :--> a) :--> a :--> a) iterateN = pfix #$ plam iterateN'
Further examples can be found in examples/Recursion.hs
An Arbitrary Term with an unknown type
Instances
PlutusType POpaque Source # | |
Defined in Plutarch.Internal.Other | |
type PContravariant' POpaque Source # | |
Defined in Plutarch.Internal.Other | |
type PCovariant' POpaque Source # | |
Defined in Plutarch.Internal.Other | |
type PInner POpaque Source # | |
Defined in Plutarch.Internal.Other | |
type PVariant' POpaque Source # | |
Defined in Plutarch.Internal.Other |