{-# LANGUAGE LinearTypes #-}
{-# LANGUAGE NoImplicitPrelude #-}
module Debug.Trace.Linear
(
trace,
traceShow,
traceId,
traceStack,
traceIO,
traceM,
traceShowM,
traceEvent,
traceEventIO,
traceMarker,
traceMarkerIO,
)
where
import Data.Functor.Linear
import Data.Unrestricted.Linear
import qualified Debug.Trace as NonLinear
import Prelude.Linear.Internal
import System.IO.Linear
import qualified Unsafe.Linear as Unsafe
import Prelude (Show (..), String)
trace :: String %1 -> a %1 -> a
trace :: forall a. String %1 -> a %1 -> a
trace = forall a b c (p :: Multiplicity) (q :: Multiplicity)
(x :: Multiplicity) (y :: Multiplicity).
(a %p -> b %q -> c) %1 -> a %x -> b %y -> c
Unsafe.toLinear2 forall a. String -> a -> a
NonLinear.trace
traceShow :: (Show a) => a -> b %1 -> b
traceShow :: forall a b. Show a => a -> b %1 -> b
traceShow a
a = forall a b (p :: Multiplicity) (x :: Multiplicity).
(a %p -> b) %1 -> a %x -> b
Unsafe.toLinear (forall a b. Show a => a -> b -> b
NonLinear.traceShow a
a)
traceId :: String %1 -> String
traceId :: String %1 -> String
traceId String
s = forall a. Dupable a => a %1 -> (a, a)
dup String
s forall a b (p :: Multiplicity) (q :: Multiplicity).
a %p -> (a %p -> b) %q -> b
& \(String
s', String
s'') -> forall a. String %1 -> a %1 -> a
trace String
s' String
s''
traceStack :: String %1 -> a %1 -> a
traceStack :: forall a. String %1 -> a %1 -> a
traceStack = forall a b c (p :: Multiplicity) (q :: Multiplicity)
(x :: Multiplicity) (y :: Multiplicity).
(a %p -> b %q -> c) %1 -> a %x -> b %y -> c
Unsafe.toLinear2 forall a. String -> a -> a
NonLinear.traceStack
traceIO :: String %1 -> IO ()
traceIO :: String %1 -> IO ()
traceIO String
s = forall a. IO a %1 -> IO a
fromSystemIO (forall a b (p :: Multiplicity) (x :: Multiplicity).
(a %p -> b) %1 -> a %x -> b
Unsafe.toLinear String -> IO ()
NonLinear.traceIO String
s)
traceM :: (Applicative f) => String %1 -> f ()
traceM :: forall (f :: * -> *). Applicative f => String %1 -> f ()
traceM String
s = forall a. String %1 -> a %1 -> a
trace String
s forall a b (p :: Multiplicity) (q :: Multiplicity).
(a %p -> b) %q -> a %p -> b
$ forall (f :: * -> *) a. Applicative f => a -> f a
pure ()
traceShowM :: (Show a, Applicative f) => a -> f ()
traceShowM :: forall a (f :: * -> *). (Show a, Applicative f) => a -> f ()
traceShowM a
a = forall (f :: * -> *). Applicative f => String %1 -> f ()
traceM (forall a. Show a => a -> String
show a
a)
traceEvent :: String %1 -> a %1 -> a
traceEvent :: forall a. String %1 -> a %1 -> a
traceEvent = forall a b c (p :: Multiplicity) (q :: Multiplicity)
(x :: Multiplicity) (y :: Multiplicity).
(a %p -> b %q -> c) %1 -> a %x -> b %y -> c
Unsafe.toLinear2 forall a. String -> a -> a
NonLinear.traceEvent
traceEventIO :: String %1 -> IO ()
traceEventIO :: String %1 -> IO ()
traceEventIO String
s = forall a. IO a %1 -> IO a
fromSystemIO (forall a b (p :: Multiplicity) (x :: Multiplicity).
(a %p -> b) %1 -> a %x -> b
Unsafe.toLinear String -> IO ()
NonLinear.traceEventIO String
s)
traceMarker :: String %1 -> a %1 -> a
traceMarker :: forall a. String %1 -> a %1 -> a
traceMarker = forall a b c (p :: Multiplicity) (q :: Multiplicity)
(x :: Multiplicity) (y :: Multiplicity).
(a %p -> b %q -> c) %1 -> a %x -> b %y -> c
Unsafe.toLinear2 forall a. String -> a -> a
NonLinear.traceMarker
traceMarkerIO :: String %1 -> IO ()
traceMarkerIO :: String %1 -> IO ()
traceMarkerIO String
s = forall a. IO a %1 -> IO a
fromSystemIO (forall a b (p :: Multiplicity) (x :: Multiplicity).
(a %p -> b) %1 -> a %x -> b
Unsafe.toLinear String -> IO ()
NonLinear.traceMarkerIO String
s)