dbg(ppshow) output improvements
- align single-line output a little better - start multi-line output on a new line and indent it
This commit is contained in:
parent
c5a839b309
commit
784e9eff8a
@ -440,8 +440,14 @@ dbgshow level
|
||||
-- Values are displayed with ppShow, each field/constructor on its own line.
|
||||
dbgppshow :: Show a => Int -> String -> a -> a
|
||||
dbgppshow level
|
||||
| debugLevel >= level = \s -> traceWith (((s++": ")++) . ppShow)
|
||||
| otherwise = flip const
|
||||
| debugLevel < level = flip const
|
||||
| otherwise = \s a -> let p = ppShow a
|
||||
ls = lines p
|
||||
nlorspace | length ls > 1 = "\n"
|
||||
| otherwise = " " ++ take (10 - length s) (repeat ' ')
|
||||
ls' | length ls > 1 = map (" "++) ls
|
||||
| otherwise = ls
|
||||
in trace (s++":"++nlorspace++intercalate "\n" ls') a
|
||||
|
||||
-- -- | Print a showable value to the console, with a message, if the
|
||||
-- -- debug level is at or above the specified level (uses
|
||||
|
||||
Loading…
Reference in New Issue
Block a user