----------------------------------------------------------------------------- -- | -- Module : Debug.TraceCall -- License : BSD-style (see the file libraries/base/LICENSE) -- -- Maintainer : bram@typlab.com -- Stability : provisional -- Portability : portable -- -- 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 ( -- * Tracing functions -- ** IO tracing -- | traceCall transforms function of the form (MonadIO m ) => a -> m b to a function which log their arguments. It will not trace -- the calls of function arguments. To also trace the calls to function arguments use traceCallDeep. traceCall , traceCallDeep -- ** Pure tracing -- | This transforms pure functions to a function which logs its arguments via Debug.Trace.trace. It will not trace -- the calls of function arguments. To also trace the calls to function arguments use traceCallDeep. , unsafeTraceCall , unsafeTraceCallDeep ) where import Debug.TraceCall.IO import Debug.TraceCall.IODeep import Debug.TraceCall.Unsafe import Debug.TraceCall.UnsafeDeep