base-compat-0.8.2: A compatibility layer for base

Safe Haskell | None
Language | Haskell98

Debug.Trace.Compat

Synopsis

- traceId :: String -> String
- traceShowId :: Show a => a -> a
- traceM :: Monad m => String -> m ()
- traceShowM :: (Show a, Monad m) => a -> m ()

# Documentation

traceId :: String -> String

Like `trace` but returns the message instead of a third value.

Since: 4.7.0.0

traceShowId :: Show a => a -> a

Like `traceShow` but returns the shown value instead of a third value.

Since: 4.7.0.0

traceM :: Monad m => String -> m ()

Like `trace` but returning unit in an arbitrary monad. Allows for convenient use in do-notation. Note that the application of `trace` is not an action in the monad, as `traceIO` is in the `IO` monad.

    ... = do
      x <- ...
      traceM $ "x: " ++ show x
      y <- ...
      traceM $ "y: " ++ show y

Since: 4.7.0.0

traceShowM :: (Show a, Monad m) => a -> m ()

Like `traceM`, but uses `show` on the argument to convert it to a `String`.

    ... = do
      x <- ...
      traceMShow $ x
      y <- ...
      traceMShow $ x + y

Since: 4.7.0.0