module Plutarch.Internal.Trace (
ptrace,
ptrace',
) where
import Plutarch.Internal (
Term,
pdelay,
pforce,
pgetConfig,
phoistAcyclic,
tracingMode,
(#),
pattern NoTracing,
type (:-->),
)
import {-# SOURCE #-} Plutarch.String (PString)
import Plutarch.Unsafe (punsafeBuiltin)
import PlutusCore qualified as PLC
ptrace' :: Term s (PString :--> a :--> a)
ptrace' :: forall (s :: S) (a :: PType). Term s (PString :--> (a :--> a))
ptrace' = forall (a :: PType) (s :: S).
HasCallStack =>
ClosedTerm a -> Term s a
phoistAcyclic forall a b. (a -> b) -> a -> b
$ forall (s :: S) (a :: PType). Term s (PDelayed a) -> Term s a
pforce forall a b. (a -> b) -> a -> b
$ forall (s :: S) (a :: PType). DefaultFun -> Term s a
punsafeBuiltin DefaultFun
PLC.Trace
ptrace :: Term s PString -> Term s a -> Term s a
ptrace :: forall (s :: S) (a :: PType).
Term s PString -> Term s a -> Term s a
ptrace Term s PString
s Term s a
a = forall (s :: S) (a :: PType). (Config -> Term s a) -> Term s a
pgetConfig \Config
c -> case Config -> TracingMode
tracingMode Config
c of
TracingMode
NoTracing -> Term s a
a
TracingMode
_ -> forall (s :: S) (a :: PType). Term s (PDelayed a) -> Term s a
pforce forall a b. (a -> b) -> a -> b
$ forall (s :: S) (a :: PType). Term s (PString :--> (a :--> a))
ptrace' forall (s :: S) (a :: PType) (b :: PType).
HasCallStack =>
Term s (a :--> b) -> Term s a -> Term s b
# Term s PString
s forall (s :: S) (a :: PType) (b :: PType).
HasCallStack =>
Term s (a :--> b) -> Term s a -> Term s b
# forall (s :: S) (a :: PType). Term s a -> Term s (PDelayed a)
pdelay Term s a
a