Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- newtype ((a :: PType) :--> (b :: PType)) (s :: S) = PLam (Term s a -> Term s b)
- data PDelayed (a :: PType) (s :: S)
- newtype Term (s :: S) (a :: PType) = Term {
- asRawTerm :: Word64 -> TermMonad TermResult
- asClosedRawTerm :: ClosedTerm a -> TermMonad TermResult
- newtype Script = Script (Program DeBruijn DefaultUni DefaultFun ())
- mapTerm :: (RawTerm -> RawTerm) -> TermResult -> TermResult
- plam' :: (Term s a -> Term s b) -> Term s (a :--> b)
- plet :: Term s a -> (Term s a -> Term s b) -> Term s b
- papp :: Term s (a :--> b) -> Term s a -> Term s b
- pdelay :: Term s a -> Term s (PDelayed a)
- pforce :: Term s (PDelayed a) -> Term s a
- phoistAcyclic :: HasCallStack => ClosedTerm a -> Term s a
- perror :: Term s a
- punsafeCoerce :: Term s a -> Term s b
- punsafeBuiltin :: DefaultFun -> Term s a
- punsafeConstant :: Some (ValueOf DefaultUni) -> Term s a
- punsafeConstantInternal :: Some (ValueOf DefaultUni) -> Term s a
- compile :: Config -> ClosedTerm a -> Either Text Script
- compileOptimized :: forall (a :: S -> Type). (forall (s :: S). Term s a) -> Either Text Script
- compile' :: TermResult -> UTerm
- type ClosedTerm (a :: PType) = forall (s :: S). Term s a
- type Dig = Digest Blake2b_160
- hashTerm :: Config -> ClosedTerm a -> Either Text Dig
- hashRawTerm :: RawTerm -> Dig
- data RawTerm
- data TermResult = TermResult {}
- data S = SI
- type PType = S -> Type
- pthrow :: HasCallStack => Text -> Term s a
- data Config where
- data TracingMode
- data LogLevel
- tracingMode :: Config -> Maybe TracingMode
- logLevel :: Config -> Maybe LogLevel
- pgetConfig :: (Config -> Term s a) -> Term s a
- newtype TermMonad m = TermMonad {
- runTermMonad :: ReaderT Config (Either Text) m
- (#) :: Term s (a :--> b) -> Term s a -> Term s b
- (#$) :: Term s (a :--> b) -> Term s a -> Term s b
Documentation
$hoisted
newtype ((a :: PType) :--> (b :: PType)) (s :: S) infixr 0 Source #
Instances
PlutusType (a :--> b) Source # | |
Defined in Plutarch.Internal.PlutusType | |
type PContravariant' (a :--> b) Source # | |
Defined in Plutarch.Internal.PlutusType | |
type PCovariant' (a :--> b) Source # | |
Defined in Plutarch.Internal.PlutusType | |
type PInner (a :--> b) Source # | |
Defined in Plutarch.Internal.PlutusType | |
type PVariant' (a :--> b) Source # | |
Defined in Plutarch.Internal.PlutusType |
$term
newtype Term (s :: S) (a :: PType) Source #
Term | |
|
Instances
asClosedRawTerm :: ClosedTerm a -> TermMonad TermResult Source #
Script (Program DeBruijn DefaultUni DefaultFun ()) |
mapTerm :: (RawTerm -> RawTerm) -> TermResult -> TermResult Source #
plam' :: (Term s a -> Term s b) -> Term s (a :--> b) Source #
Lambda abstraction.
Only works with a single argument.
Use plam
instead, to support currying.
plet :: Term s a -> (Term s a -> Term s b) -> Term s b Source #
Let bindings.
This is approximately a shorthand for a lambda and application:
plet v f
== papp (plam f) v
But sufficiently small terms in WHNF may be inlined for efficiency.
pforce :: Term s (PDelayed a) -> Term s a Source #
Plutus 'force',
used to force evaluation of PDelayed
terms.
phoistAcyclic :: HasCallStack => ClosedTerm a -> Term s a Source #
Plutus 'error'.
When using this explicitly, it should be ensured that the containing term is delayed, avoiding premature evaluation.
punsafeCoerce :: Term s a -> Term s b Source #
Unsafely coerce the type-tag of a Term.
This should mostly be avoided, though it can be safely used to assert known types of Datums, Redeemers or ScriptContext.
punsafeBuiltin :: DefaultFun -> Term s a Source #
punsafeConstant :: Some (ValueOf DefaultUni) -> Term s a Source #
Deprecated: Use pconstant
instead.
punsafeConstantInternal :: Some (ValueOf DefaultUni) -> Term s a Source #
compile :: Config -> ClosedTerm a -> Either Text Script Source #
Compile a (closed) Plutus Term to a usable script
compileOptimized :: forall (a :: S -> Type). (forall (s :: S). Term s a) -> Either Text Script Source #
compile' :: TermResult -> UTerm Source #
type ClosedTerm (a :: PType) = forall (s :: S). Term s a Source #
- Closed* terms with no free variables.
hashRawTerm :: RawTerm -> Dig Source #
data TermResult Source #
Instances
Configuration for Plutarch scripts at compile time. This indicates whether we want to trace, and if so, under what log level and mode.
Since: 1.6.0
pattern NoTracing :: Config | Pattern for the config that does no tracing (also the default). Since: 1.6.0 |
pattern Tracing :: LogLevel -> TracingMode -> Config | Pattern for a tracing config, with both its log level and mode. Since: 1.6.0 |
Instances
FromJSON Config Source # | Since: 1.6.0 |
Defined in Plutarch.Internal.Term parseJSON :: Value -> Parser Config parseJSONList :: Value -> Parser [Config] | |
ToJSON Config Source # | Since: 1.6.0 |
Defined in Plutarch.Internal.Term toEncoding :: Config -> Encoding toJSONList :: [Config] -> Value toEncodingList :: [Config] -> Encoding | |
Monoid Config Source # | Since: 1.6.0 |
Semigroup Config Source # | Since: 1.6.0 |
Show Config Source # | Since: 1.6.0 |
Eq Config Source # | Since: 1.6.0 |
Pretty Config Source # | Since: 1.6.0 |
Defined in Plutarch.Internal.Term prettyList :: [Config] -> Doc ann |
data TracingMode Source #
How to trace.
Since: 1.6.0
Instances
What logging level we want to use.
Since: 1.6.0
Instances
FromJSON LogLevel Source # | Since: 1.6.0 |
Defined in Plutarch.Internal.Term parseJSON :: Value -> Parser LogLevel parseJSONList :: Value -> Parser [LogLevel] | |
ToJSON LogLevel Source # | Since: 1.6.0 |
Defined in Plutarch.Internal.Term toEncoding :: LogLevel -> Encoding toJSONList :: [LogLevel] -> Value toEncodingList :: [LogLevel] -> Encoding | |
Semigroup LogLevel Source # | More general logging supersedes less general. Since: 1.6.0 |
Show LogLevel Source # | Since: 1.6.0 |
Eq LogLevel Source # | Since: 1.6.0 |
Ord LogLevel Source # | We have a linear order of generality, so this instance reflects it:
Since: 1.6.0 |
Defined in Plutarch.Internal.Term | |
Pretty LogLevel Source # | Since: 1.6.0 |
Defined in Plutarch.Internal.Term prettyList :: [LogLevel] -> Doc ann |
tracingMode :: Config -> Maybe TracingMode Source #
If the config indicates that we want to trace, get its mode.
Since: 1.6.0
logLevel :: Config -> Maybe LogLevel Source #
If the config indicates that we want to trace, get its log level.
Since: 1.6.0