-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | functions for logging the arguments and results of function calls
--
-- trace-call provides generic functions for logging the arguments and
-- results of function calls
@package trace-call
@version 0.1
module Debug.TraceCall.Base
-- |
-- - Data collected during inspecting function calls
--
data TraceData
TraceData :: String -> [String] -> Maybe TraceData -> TraceData
function :: TraceData -> String
args :: TraceData -> [String]
context :: TraceData -> Maybe TraceData
traceToString :: TraceData -> [String]
traceResult :: TraceData -> String -> String
module Debug.TraceCall.IO
class TCIO a
tcIO :: TCIO a => TraceData -> Int -> a -> a
class TAIO a
taIO :: TAIO a => String -> a -> String
traceCall :: TCIO a => String -> a -> a
instance [overlap ok] TCIO (a -> r) => TAIO (a -> r)
instance [overlap ok] Show a => TAIO a
instance [overlap ok] (TAIO a, TCIO r) => TCIO (a -> r)
instance [overlap ok] (Show a, MonadIO m) => TCIO (m a)
module Debug.TraceCall.IODeep
class TCDeepIO a
tcDeepIO :: TCDeepIO a => TraceData -> Int -> (TraceData -> a) -> a -> a
class TADeepIO a
taDeepIO :: TADeepIO a => String -> a -> Either String (TraceData -> a)
traceCallDeep :: TCDeepIO a => String -> a -> a
instance [overlap ok] TCDeepIO (a -> r) => TADeepIO (a -> r)
instance [overlap ok] Show a => TADeepIO a
instance [overlap ok] (TADeepIO a, TCDeepIO r) => TCDeepIO (a -> r)
instance [overlap ok] (Show a, MonadIO m) => TCDeepIO (m a)
module Debug.TraceCall.Unsafe
class TCUnsafe a
tcUnsafe :: TCUnsafe a => TraceData -> Int -> a -> a
class TAUnsafe a
taUnsafe :: TAUnsafe a => String -> a -> String
unsafeTraceCall :: TCUnsafe a => String -> a -> a
instance [overlap ok] TCUnsafe (a -> r) => TAUnsafe (a -> r)
instance [overlap ok] Show a => TAUnsafe a
instance [overlap ok] (TAUnsafe a, TCUnsafe r) => TCUnsafe (a -> r)
instance [overlap ok] Show a => TCUnsafe a
module Debug.TraceCall.UnsafeDeep
class TCDeepUnsafe a
tcDeepUnsafe :: TCDeepUnsafe a => TraceData -> Int -> (TraceData -> a) -> a -> a
class TADeepUnsafe a
taDeepUnsafe :: TADeepUnsafe a => String -> a -> Either String (TraceData -> a)
unsafeTraceCallDeep :: TCDeepUnsafe a => String -> a -> a
instance [overlap ok] TCDeepUnsafe (a -> r) => TADeepUnsafe (a -> r)
instance [overlap ok] Show a => TADeepUnsafe a
instance [overlap ok] (TADeepUnsafe a, TCDeepUnsafe r) => TCDeepUnsafe (a -> r)
instance [overlap ok] Show a => TCDeepUnsafe a
-- | This module contains convenience methods for logging/tracing function
-- calls and their arguments. More examples of how this library can be
-- used can be found in Debug.TraceCall.Examples.
--
-- A traceCall function can be applied to a normal function and
-- transforms that function into a function that will log its output.
-- unsafeTraceCall takes as argument a pure function and transforms it
-- into a function which uses Debug.Trace.trace to log its argument and
-- result. The normal traceCall function works on function of the form a
-- -> IO b and does its logging through IO.
--
-- For a tracecall to work all arguments should be an instance of Show.
-- The only exception are function arguments. The normal traceCall
-- functions will ignore the function arguments in their report. The
-- -Deep versions of traceCall will also add traces to function
-- arguments, so the usages of the function arguments will also be
-- logged. To try this out, type in th following in ghci:
--
-- unsafeTraceCallDeep "map" map sqrt [1..5]
module Debug.TraceCall
traceCall :: TCIO a => String -> a -> a
traceCallDeep :: TCDeepIO a => String -> a -> a
unsafeTraceCall :: TCUnsafe a => String -> a -> a
unsafeTraceCallDeep :: TCDeepUnsafe a => String -> a -> a
-- | This modules contains examples of how to use Debug.TraceCall
module Debug.TraceCall.Examples
-- | Creating a logged version of splitAt
logSplitAt :: Show a => Int -> [a] -> ([a], [a])
-- | We don't have to create specialized versions, we can also do this
-- inline, on any function.
logSplitAtEx2 :: ([Int], [Int])
-- | By default function arguments will be ignored
logMapEx :: [Float]
-- | With the deep version we can also trace the function
-- arguments
logMapDeepEx :: [Float]
-- | The normal traceCall function operates within the IO monad
logReadFile :: String -> IO String
-- | It is even possible to log closures
logClosure :: [Int]