file-location-0.4.5.1: common functions that show file location information

Safe HaskellNone

FileLocation

Description

see Debug.FileLocation module for more definitions

Synopsis

Documentation

err :: String -> Q ExpSource

Like Prelude.error, but gives the file location.

 $(err "OH NO!")
 main:Main main.hs:4:10 OH NO!

err' :: Q ExpSource

Like err, but the error message (to be appended to the location) is an argument of the generated expression.

 $(err) "OH NO!"
 main:Main main.hs:4:10 OH NO!

undef :: Q ExpSource

Like Prelude.undefined, but gives the file location.

Uses trace to output the location (this way we still use undefined instead of calling error).

 $(undef)
 main:Main main.hs:4:10 undefined
 err: Prelude.undefined

fromJst :: Q ExpSource

Like fromJust, but also shows the file location.

fromRht :: Q ExpSource

Like fromRight, but also show the file location.

indx :: Q ExpSource

Like (flip (!), but also shows the file location in case the element isn't found.

indxShow :: Q ExpSource

Like indx, but also shows the looked-up element in case it isn't found.

debug :: Show a => a -> aSource

A version of Debug.Trace.trace that just prints a value. This should be included in Debug.Trace

debugM :: (Monad m, Show a) => a -> m aSource

Monadic debug - like debug, but works as a standalone line in a monad.

TODO: TH version with error loaction info

debugMsg :: Show a => String -> a -> aSource

A version of Debug.Trace.trace that just prints a value and a message. This should be included in Debug.Trace

debugMsgIf :: Show a => String -> (a -> Bool) -> a -> aSource

A version of Debug.Trace.trace that just prints a value and a message. This should be included in Debug.Trace

dbg :: Q ExpSource

TH version of Debug.Trace.trace that just prints a value.

dbgMsg :: String -> Q ExpSource

TH version of Debug.Trace.trace that prints a value and a message prefix.

trc :: String -> Q ExpSource

A TH version of Debug.Trace.trace that prints location information

ltrace :: Show a => String -> a -> aSource

Labelled trace - like strace, but with a label prepended.

ltraceM :: (Monad m, Show a) => String -> a -> m aSource

Monadic debug - like debug, but works as a standalone line in a monad.

TODO: TH version with error loaction info

strace :: Show a => a -> aSource

Trace (print on stderr at runtime) a showable expression like debug, but do not print "DEBUG: ".

"strace" stands for "show trace".