Skip to content

Commit

Permalink
Make debug output even prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
anka-213 committed Oct 19, 2021
1 parent 25ea2aa commit 74e1ee5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mengwong/mp/src/Lib.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ debugPrint :: String -> Parser ()
debugPrint str = whenDebug $ do
lookingAt <- lookAhead (getToken :: Parser MyToken)
depth <- asks callDepth
myTraceM $ str <> " running. depth=" <> show depth <> "; looking at: " <> show lookingAt
myTraceM $ "/ " <> str <> " running. depth=" <> show depth <> "; looking at: " <> show lookingAt

debugName :: Show a => String -> Parser a -> Parser a
debugName name p = do
debugPrint name
res <- local (increaseNestLevel name) p
myTraceM $ name ++ " has returned " ++ show res
myTraceM $ "\\ " <> name <> " has returned " <> show res
return res

-- | withDepth n p sets the depth to n for parser p
Expand Down

0 comments on commit 74e1ee5

Please sign in to comment.