Debug.Trace
- Package
- purescript-debug
- Repository
- garyb/purescript-debug
#DebugWarning Source
class DebugWarning Nullary class used to raise a custom warning for the debug functions.
Instances
(Warn "Debug.Trace usage") => DebugWarning
#trace Source
trace :: forall a. DebugWarning => String -> (Unit -> a) -> aLog a message to the console for debugging purposes and then return a value. The return value is thunked so it is not evaluated until after the message has been printed, to preserve a predictable console output.
For example:
doSomething = trace "Hello" \_ -> ... some value or computation ...
#traceShow Source
traceShow :: forall b a. DebugWarning => Show a => a -> (Unit -> b) -> bLog a Showable value to the console for debugging purposes and then
return a value.
#traceAny Source
traceAny :: forall b a. DebugWarning => a -> (Unit -> b) -> bLog any PureScript value to the console for debugging purposes and then return a value. This will log the value's underlying representation for low-level debugging.
#spy Source
spy :: forall a. DebugWarning => a -> aLog any value and return it
#traceAnyA Source
traceAnyA :: forall b a. DebugWarning => Applicative a => b -> a UnitLog any PureScript value to the console and return the unit value of the
Applicative a.
#traceA Source
traceA :: forall a. DebugWarning => Applicative a => String -> a UnitLog a message to the console for debugging purposes and then return the
unit value of the Applicative a.
For example:
doSomething = do
traceA "Hello"
... some value or computation ...
#traceShowA Source
traceShowA :: forall b a. DebugWarning => Show b => Applicative a => b -> a UnitLog a Showable value to the console for debugging purposes and then
return the unit value of the Applicative a.
#traceAnyM Source
traceAnyM :: forall a m. DebugWarning => Monad m => a -> m aLog any PureScript value to the console and return it in Monad
useful when one has monadic chains
mbArray :: Maybe (Array Int)
foo :: Int
foo = fromMaybe zero
$ mbArray
>>= traceAnyM
>>= head
>>= traceAnyM
#traceShowM Source
traceShowM :: forall a m. DebugWarning => Show a => Monad m => a -> m aSame as traceAnyM but only for Showable values
- Modules
- Debug.
Trace