Module

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

#trace Source

trace :: forall a. DebugWarning => String -> (Unit -> a) -> a

Log 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) -> b

Log a Showable value to the console for debugging purposes and then return a value.

#traceAny Source

traceAny :: forall b a. DebugWarning => a -> (Unit -> b) -> b

Log 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 -> a

Log any value and return it

#traceAnyA Source

traceAnyA :: forall b a. DebugWarning => Applicative a => b -> a Unit

Log 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 Unit

Log 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 Unit

Log 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 a

Log 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 a

Same as traceAnyM but only for Showable values

Modules
Debug.Trace