| Copyright | (C) 2014-2015 Ryan Scott |
|---|---|
| License | BSD-style (see the file LICENSE) |
| Maintainer | Ryan Scott |
| Stability | Experimental |
| Portability | GHC |
| Safe Haskell | None |
| Language | Haskell98 |
Text.Show.Text.Debug.Trace
Description
Functions for tracing and monitoring execution.
These can be useful for investigating bugs or performance problems. They should not be used in production code.
If you do not wish to require Show instances for your trace functions,
the Text.Show.Text.Debug.Trace.TH and Text.Show.Text.Debug.Trace.Generic modules
exist to convert the input to a debug message using Template Haskell or generics,
respectively.
Since: 0.5
- traceIO :: Text -> IO ()
- traceIOLazy :: Text -> IO ()
- trace :: Text -> a -> a
- traceLazy :: Text -> a -> a
- traceId :: Text -> Text
- traceIdLazy :: Text -> Text
- traceShow :: Show a => a -> b -> b
- traceShowId :: Show a => a -> a
- traceM :: Monad m => Text -> m ()
- traceMLazy :: Monad m => Text -> m ()
- traceShowM :: (Show a, Monad m) => a -> m ()
- traceStack :: Text -> a -> a
- traceStackLazy :: Text -> a -> a
- traceEvent :: Text -> a -> a
- traceEventLazy :: Text -> a -> a
- traceEventIO :: Text -> IO ()
- traceEventIOLazy :: Text -> IO ()
- traceMarker :: Text -> a -> a
- traceMarkerLazy :: Text -> a -> a
- traceMarkerIO :: Text -> IO ()
- traceMarkerIOLazy :: Text -> IO ()
Documentation
traceIO :: Text -> IO () Source
The traceIO function outputs the trace message from the IO monad.
This sequences the output with respect to other IO actions.
Since: 0.5
trace :: Text -> a -> a Source
The trace function outputs the trace message given as its first argument,
before returning the second argument as its result.
For example, this returns the value of f x but first outputs the message.
trace ("calling f with x = " <> show x) (f x)The trace function should only be used for debugging, or for monitoring
execution. The function is not referentially transparent: its type indicates
that it is a pure function but it has the side effect of outputting the
trace message.
Since: 0.5
traceId :: Text -> Text Source
Like trace but returns the message instead of a third value.
Since: 0.5
traceShowId :: Show a => a -> a Source
Like traceShow but returns the shown value instead of a third value.
Since: 0.5
traceShowM :: (Show a, Monad m) => a -> m () Source
traceStack :: Text -> a -> a Source
Like trace but additionally prints a call stack if one is
available.
In the current GHC implementation, the call stack is only
availble if the program was compiled with -prof; otherwise
traceStack behaves exactly like trace. Entries in the call
stack correspond to SCC annotations, so it is a good idea to use
-fprof-auto or -fprof-auto-calls to add SCC annotations automatically.
Since: 0.5
traceStackLazy :: Text -> a -> a Source
Like traceStack but accepts a lazy Text argument.
Since: 0.5
traceEvent :: Text -> a -> a Source
The traceEvent function behaves like trace with the difference that
the message is emitted to the eventlog, if eventlog profiling is available
and enabled at runtime.
It is suitable for use in pure code. In an IO context use traceEventIO
instead.
Note that when using GHC's SMP runtime, it is possible (but rare) to get
duplicate events emitted if two CPUs simultaneously evaluate the same thunk
that uses traceEvent.
Since: 0.5
traceEventLazy :: Text -> a -> a Source
Like traceEvent but accepts a lazy Text argument.
Since: 0.5
traceEventIO :: Text -> IO () Source
The traceEventIO function emits a message to the eventlog, if eventlog
profiling is available and enabled at runtime.
Compared to traceEvent, traceEventIO sequences the event with respect to
other IO actions.
Since: 0.5
traceEventIOLazy :: Text -> IO () Source
Like traceEventIO but accepts a lazy Text argument.
Since: 0.5
traceMarker :: Text -> a -> a Source
The traceMarker function emits a marker to the eventlog, if eventlog
profiling is available and enabled at runtime. The Text is the name of
the marker. The name is just used in the profiling tools to help you keep
clear which marker is which.
This function is suitable for use in pure code. In an IO context use
traceMarkerIO instead.
Note that when using GHC's SMP runtime, it is possible (but rare) to get
duplicate events emitted if two CPUs simultaneously evaluate the same thunk
that uses traceMarker.
Since: 0.5
traceMarkerLazy :: Text -> a -> a Source
Like traceMarker but accepts a lazy Text argument.
Since: 0.5
traceMarkerIO :: Text -> IO () Source
The traceMarkerIO function emits a marker to the eventlog, if eventlog
profiling is available and enabled at runtime.
Compared to traceMarker, traceMarkerIO sequences the event with respect to
other IO actions.
Since: 0.5
traceMarkerIOLazy :: Text -> IO () Source
Like traceMarkerIO but accepts a lazy Text argument.
Since: 0.5