file-location 0.2.2 → 0.2.3
raw patch · 3 files changed
+53/−34 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Debug.FileLocation: strace :: Show a => a -> a
+ Debug.FileLocation: strace, traceId :: Show a => a -> a
+ Debug.Util: debug :: Show a => a -> a
+ Debug.Util: debugM :: (Monad m, Show a) => a -> m a
+ Debug.Util: debugMsg :: Show a => String -> a -> a
+ Debug.Util: ltrace :: Show a => String -> a -> a
+ Debug.Util: ltraceM :: (Monad m, Show a) => String -> a -> m a
+ Debug.Util: strace, traceId :: Show a => a -> a
+ FileLocation.LocationString: locationToString :: Loc -> String
Files
- Debug/FileLocation.hs +6/−31
- Debug/Util.hs +42/−0
- file-location.cabal +5/−3
Debug/FileLocation.hs view
@@ -1,22 +1,16 @@ {-# LANGUAGE TemplateHaskell #-}+-- | functions that help you with debugging.+-- Most would make sense in the Debug.Trace module+-- There are Template Haskell versions that show you file locaiton information module Debug.FileLocation- (debug, debugM, debugMsg, dbg, dbgMsg, trc, ltrace, ltraceM, strace)+ (debug, debugM, debugMsg, dbg, dbgMsg, trc, ltrace, ltraceM, strace, traceId) where import Language.Haskell.TH.Syntax-import Debug.Trace+import Debug.Util+import Debug.Trace (trace) import FileLocation.LocationString (locationToString) --- | A version of Debug.Trace.trace that just prints a value.--- This should be included in Debug.Trace-debug :: Show a => a -> a-debug = ltrace "DEBUG"---- | A version of Debug.Trace.trace that just prints a value and a message.--- This should be included in Debug.Trace-debugMsg :: Show a => String -> a -> a-debugMsg msg = ltrace ("DEBUG: " ++ msg)- -- | TH version of Debug.Trace.trace that just prints a value. dbg :: Q Exp dbg = do@@ -45,22 +39,3 @@ loc <- qLocation let prefix = "DEBUG: " ++ (locationToString loc) ++ " " [|(\x -> ltraceM (prefix ++ show x) x)|]---- | monadic debug - like debug, but works as a standalone line in a monad--- TODO: TH version with error loaction info-debugM :: (Monad m, Show a) => a -> m a-debugM a = debug a `seq` return a---- | trace (print on stdout at runtime) a showable expression--- like debug, but does not print "DEBUG: "-strace :: Show a => a -> a-strace a = trace (show a) a---- | labelled trace - like strace, with a label prepended-ltrace :: Show a => String -> a -> a-ltrace l a = trace (l ++ ": " ++ show a) a---- | monadic debug - like debug, but works as a standalone line in a monad--- TODO: TH version with error loaction info-ltraceM :: (Monad m, Show a) => String -> a -> m a-ltraceM str a = ltrace str a `seq` return a
+ Debug/Util.hs view
@@ -0,0 +1,42 @@+-- | functions that help you with debugging.+-- Most would make sense in the Debug.Trace module+module Debug.Util + (debug, debugM, debugMsg, ltrace, ltraceM, strace, traceId)+ where++import Debug.Trace (trace)++-- | A version of Debug.Trace.trace that just prints a value.+-- This should be included in Debug.Trace+debug :: Show a => a -> a+debug = ltrace "DEBUG"++-- | A version of Debug.Trace.trace that just prints a value and a message.+-- This should be included in Debug.Trace+debugMsg :: Show a => String -> a -> a+debugMsg msg = ltrace ("DEBUG: " ++ msg)+++-- | monadic debug - like debug, but works as a standalone line in a monad+-- TODO: TH version with error loaction info+debugM :: (Monad m, Show a) => a -> m a+debugM a = debug a `seq` return a++-- | trace (print on stdout at runtime) a showable expression+-- like debug, but does not print "DEBUG: "+-- traceId is an alias for strace+-- strace stands for "show trace"+-- traceId means it returns itself after tracing like the id function+strace, traceId :: Show a => a -> a+strace a = trace (show a) a++traceId = strace++-- | labelled trace - like strace, with a label prepended+ltrace :: Show a => String -> a -> a+ltrace l a = trace (l ++ ": " ++ show a) a++-- | monadic debug - like debug, but works as a standalone line in a monad+-- TODO: TH version with error loaction info+ltraceM :: (Monad m, Show a) => String -> a -> m a+ltraceM str a = ltrace str a `seq` return a
file-location.cabal view
@@ -1,5 +1,5 @@ Name: file-location-Version: 0.2.2+Version: 0.2.3 Synopsis: common functions that show file location information Homepage: https://github.com/gregwebs/ErrorLocation.hs License: BSD3@@ -40,8 +40,10 @@ location: https://github.com/gregwebs/FileLocation.hs Library- Exposed-modules: FileLocation, Debug.FileLocation- Other-modules: FileLocation.LocationString+ Exposed-modules: FileLocation,+ Debug.FileLocation,+ Debug.Util,+ FileLocation.LocationString -- Packages needed in order to build this package. Build-depends: base >= 4 && < 5,