module Plutarch.Trace (
ptraceInfo,
ptraceInfoShowId,
ptraceInfoError,
ptraceInfoIfTrue,
ptraceInfoIfFalse,
ptraceDebug,
ptraceDebugShowId,
ptraceDebugIfTrue,
ptraceDebugIfFalse,
ptraceDebugError,
ptrace,
ptraceShowId,
ptraceError,
ptraceIfTrue,
ptraceIfFalse,
) where
import Data.Kind (Type)
import Plutarch.Builtin.Bool (PBool, pif)
import Plutarch.Internal.Term (
Config (NoTracing, Tracing),
LogLevel (LogDebug, LogInfo),
S,
Term,
perror,
pgetConfig,
plet,
(#),
)
import Plutarch.Internal.Trace (ptrace, ptrace', ptraceDebug, ptraceInfo)
import Plutarch.Show (PShow, pshow)
import Plutarch.String (PString)
ptraceInfoShowId ::
forall (a :: S -> Type) (s :: S).
PShow a =>
Term s a ->
Term s a
ptraceInfoShowId :: forall (a :: S -> Type) (s :: S). PShow a => Term s a -> Term s a
ptraceInfoShowId Term s a
x = (Config -> Term s a) -> Term s a
forall (s :: S) (a :: S -> Type). (Config -> Term s a) -> Term s a
pgetConfig ((Config -> Term s a) -> Term s a)
-> (Config -> Term s a) -> Term s a
forall a b. (a -> b) -> a -> b
$ \case
Config
NoTracing -> Term s a
x
Tracing LogLevel
_ TracingMode
_ -> Term s PString -> Term s a -> Term s a
forall (a :: S -> Type) (s :: S).
Term s PString -> Term s a -> Term s a
ptraceInfo (Term s a -> Term s PString
forall (a :: S -> Type) (s :: S).
PShow a =>
Term s a -> Term s PString
pshow Term s a
x) Term s a
x
ptraceShowId ::
forall (a :: S -> Type) (s :: S).
PShow a =>
Term s a ->
Term s a
ptraceShowId :: forall (a :: S -> Type) (s :: S). PShow a => Term s a -> Term s a
ptraceShowId = Term s a -> Term s a
forall (a :: S -> Type) (s :: S). PShow a => Term s a -> Term s a
ptraceInfoShowId
{-# DEPRECATED ptraceShowId "Use ptraceInfoShowId" #-}
ptraceDebugShowId ::
forall (a :: S -> Type) (s :: S).
PShow a =>
Term s a ->
Term s a
ptraceDebugShowId :: forall (a :: S -> Type) (s :: S). PShow a => Term s a -> Term s a
ptraceDebugShowId Term s a
x = (Config -> Term s a) -> Term s a
forall (s :: S) (a :: S -> Type). (Config -> Term s a) -> Term s a
pgetConfig ((Config -> Term s a) -> Term s a)
-> (Config -> Term s a) -> Term s a
forall a b. (a -> b) -> a -> b
$ \case
Config
NoTracing -> Term s a
x
Config
_ -> Term s PString -> Term s a -> Term s a
forall (a :: S -> Type) (s :: S).
Term s PString -> Term s a -> Term s a
ptraceDebug (Term s a -> Term s PString
forall (a :: S -> Type) (s :: S).
PShow a =>
Term s a -> Term s PString
pshow Term s a
x) Term s a
x
ptraceInfoError ::
forall (a :: S -> Type) (s :: S).
Term s PString ->
Term s a
ptraceInfoError :: forall (a :: S -> Type) (s :: S). Term s PString -> Term s a
ptraceInfoError = (Term s PString -> Term s a -> Term s a)
-> Term s a -> Term s PString -> Term s a
forall a b c. (a -> b -> c) -> b -> a -> c
flip Term s PString -> Term s a -> Term s a
forall (a :: S -> Type) (s :: S).
Term s PString -> Term s a -> Term s a
ptraceInfo Term s a
forall (s :: S) (a :: S -> Type). Term s a
perror
ptraceError ::
forall (a :: S -> Type) (s :: S).
Term s PString ->
Term s a
ptraceError :: forall (a :: S -> Type) (s :: S). Term s PString -> Term s a
ptraceError = Term s PString -> Term s a
forall (a :: S -> Type) (s :: S). Term s PString -> Term s a
ptraceInfoError
{-# DEPRECATED ptraceError "Use ptraceInfoError" #-}
ptraceDebugError ::
forall (a :: S -> Type) (s :: S).
Term s PString ->
Term s a
ptraceDebugError :: forall (a :: S -> Type) (s :: S). Term s PString -> Term s a
ptraceDebugError = (Term s PString -> Term s a -> Term s a)
-> Term s a -> Term s PString -> Term s a
forall a b c. (a -> b -> c) -> b -> a -> c
flip Term s PString -> Term s a -> Term s a
forall (a :: S -> Type) (s :: S).
Term s PString -> Term s a -> Term s a
ptraceDebug Term s a
forall (s :: S) (a :: S -> Type). Term s a
perror
ptraceInfoIfTrue ::
forall (s :: S).
Term s PString ->
Term s PBool ->
Term s PBool
ptraceInfoIfTrue :: forall (s :: S). Term s PString -> Term s PBool -> Term s PBool
ptraceInfoIfTrue Term s PString
msg Term s PBool
x = (Config -> Term s PBool) -> Term s PBool
forall (s :: S) (a :: S -> Type). (Config -> Term s a) -> Term s a
pgetConfig ((Config -> Term s PBool) -> Term s PBool)
-> (Config -> Term s PBool) -> Term s PBool
forall a b. (a -> b) -> a -> b
$ \case
Config
NoTracing -> Term s PBool
x
Config
_ -> Term s PBool -> (Term s PBool -> Term s PBool) -> Term s PBool
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
Term s a -> (Term s a -> Term s b) -> Term s b
plet Term s PBool
x ((Term s PBool -> Term s PBool) -> Term s PBool)
-> (Term s PBool -> Term s PBool) -> Term s PBool
forall a b. (a -> b) -> a -> b
$ \Term s PBool
x' -> Term s PBool -> Term s PBool -> Term s PBool -> Term s PBool
forall (a :: S -> Type) (s :: S).
Term s PBool -> Term s a -> Term s a -> Term s a
pif Term s PBool
x' (Term s (PString :--> (PBool :--> PBool))
forall (s :: S) (a :: S -> Type). Term s (PString :--> (a :--> a))
ptrace' Term s (PString :--> (PBool :--> PBool))
-> Term s PString -> Term s (PBool :--> PBool)
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PString
msg Term s (PBool :--> PBool) -> Term s PBool -> Term s PBool
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PBool
x') Term s PBool
x'
ptraceIfTrue ::
forall (s :: S).
Term s PString ->
Term s PBool ->
Term s PBool
ptraceIfTrue :: forall (s :: S). Term s PString -> Term s PBool -> Term s PBool
ptraceIfTrue = Term s PString -> Term s PBool -> Term s PBool
forall (s :: S). Term s PString -> Term s PBool -> Term s PBool
ptraceInfoIfTrue
{-# DEPRECATED ptraceIfTrue "Use ptraceInfoIfTrue" #-}
ptraceDebugIfTrue ::
forall (s :: S).
Term s PString ->
Term s PBool ->
Term s PBool
ptraceDebugIfTrue :: forall (s :: S). Term s PString -> Term s PBool -> Term s PBool
ptraceDebugIfTrue Term s PString
msg Term s PBool
x = (Config -> Term s PBool) -> Term s PBool
forall (s :: S) (a :: S -> Type). (Config -> Term s a) -> Term s a
pgetConfig ((Config -> Term s PBool) -> Term s PBool)
-> (Config -> Term s PBool) -> Term s PBool
forall a b. (a -> b) -> a -> b
$ \case
Config
NoTracing -> Term s PBool
x
Tracing LogLevel
ll TracingMode
_ -> case LogLevel
ll of
LogLevel
LogInfo -> Term s PBool
x
LogLevel
LogDebug -> Term s PBool -> (Term s PBool -> Term s PBool) -> Term s PBool
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
Term s a -> (Term s a -> Term s b) -> Term s b
plet Term s PBool
x ((Term s PBool -> Term s PBool) -> Term s PBool)
-> (Term s PBool -> Term s PBool) -> Term s PBool
forall a b. (a -> b) -> a -> b
$ \Term s PBool
x' -> Term s PBool -> Term s PBool -> Term s PBool -> Term s PBool
forall (a :: S -> Type) (s :: S).
Term s PBool -> Term s a -> Term s a -> Term s a
pif Term s PBool
x' (Term s (PString :--> (PBool :--> PBool))
forall (s :: S) (a :: S -> Type). Term s (PString :--> (a :--> a))
ptrace' Term s (PString :--> (PBool :--> PBool))
-> Term s PString -> Term s (PBool :--> PBool)
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PString
msg Term s (PBool :--> PBool) -> Term s PBool -> Term s PBool
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PBool
x') Term s PBool
x'
ptraceInfoIfFalse ::
forall (s :: S).
Term s PString ->
Term s PBool ->
Term s PBool
ptraceInfoIfFalse :: forall (s :: S). Term s PString -> Term s PBool -> Term s PBool
ptraceInfoIfFalse Term s PString
msg Term s PBool
x = (Config -> Term s PBool) -> Term s PBool
forall (s :: S) (a :: S -> Type). (Config -> Term s a) -> Term s a
pgetConfig ((Config -> Term s PBool) -> Term s PBool)
-> (Config -> Term s PBool) -> Term s PBool
forall a b. (a -> b) -> a -> b
$ \case
Config
NoTracing -> Term s PBool
x
Config
_ -> Term s PBool -> (Term s PBool -> Term s PBool) -> Term s PBool
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
Term s a -> (Term s a -> Term s b) -> Term s b
plet Term s PBool
x ((Term s PBool -> Term s PBool) -> Term s PBool)
-> (Term s PBool -> Term s PBool) -> Term s PBool
forall a b. (a -> b) -> a -> b
$ \Term s PBool
x' -> Term s PBool -> Term s PBool -> Term s PBool -> Term s PBool
forall (a :: S -> Type) (s :: S).
Term s PBool -> Term s a -> Term s a -> Term s a
pif Term s PBool
x' Term s PBool
x' (Term s (PString :--> (PBool :--> PBool))
forall (s :: S) (a :: S -> Type). Term s (PString :--> (a :--> a))
ptrace' Term s (PString :--> (PBool :--> PBool))
-> Term s PString -> Term s (PBool :--> PBool)
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PString
msg Term s (PBool :--> PBool) -> Term s PBool -> Term s PBool
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PBool
x')
ptraceIfFalse ::
forall (s :: S).
Term s PString ->
Term s PBool ->
Term s PBool
ptraceIfFalse :: forall (s :: S). Term s PString -> Term s PBool -> Term s PBool
ptraceIfFalse = Term s PString -> Term s PBool -> Term s PBool
forall (s :: S). Term s PString -> Term s PBool -> Term s PBool
ptraceInfoIfFalse
{-# DEPRECATED ptraceIfFalse "Use ptraceInfoIfFalse" #-}
ptraceDebugIfFalse ::
forall (s :: S).
Term s PString ->
Term s PBool ->
Term s PBool
ptraceDebugIfFalse :: forall (s :: S). Term s PString -> Term s PBool -> Term s PBool
ptraceDebugIfFalse Term s PString
msg Term s PBool
x = (Config -> Term s PBool) -> Term s PBool
forall (s :: S) (a :: S -> Type). (Config -> Term s a) -> Term s a
pgetConfig ((Config -> Term s PBool) -> Term s PBool)
-> (Config -> Term s PBool) -> Term s PBool
forall a b. (a -> b) -> a -> b
$ \case
Config
NoTracing -> Term s PBool
x
Tracing LogLevel
ll TracingMode
_ -> case LogLevel
ll of
LogLevel
LogInfo -> Term s PBool
x
LogLevel
LogDebug -> Term s PBool -> (Term s PBool -> Term s PBool) -> Term s PBool
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
Term s a -> (Term s a -> Term s b) -> Term s b
plet Term s PBool
x ((Term s PBool -> Term s PBool) -> Term s PBool)
-> (Term s PBool -> Term s PBool) -> Term s PBool
forall a b. (a -> b) -> a -> b
$ \Term s PBool
x' -> Term s PBool -> Term s PBool -> Term s PBool -> Term s PBool
forall (a :: S -> Type) (s :: S).
Term s PBool -> Term s a -> Term s a -> Term s a
pif Term s PBool
x' Term s PBool
x' (Term s (PString :--> (PBool :--> PBool))
forall (s :: S) (a :: S -> Type). Term s (PString :--> (a :--> a))
ptrace' Term s (PString :--> (PBool :--> PBool))
-> Term s PString -> Term s (PBool :--> PBool)
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PString
msg Term s (PBool :--> PBool) -> Term s PBool -> Term s PBool
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PBool
x')