From 42c7383f57ed653f8a97ff1d376024db4a765139 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sat, 23 Dec 2023 07:33:02 -1000 Subject: [PATCH] ;dev:Hledger.Utils.Parse: cleanup --- hledger-lib/Hledger/Utils/Parse.hs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/hledger-lib/Hledger/Utils/Parse.hs b/hledger-lib/Hledger/Utils/Parse.hs index a8c217770..f05bcc320 100644 --- a/hledger-lib/Hledger/Utils/Parse.hs +++ b/hledger-lib/Hledger/Utils/Parse.hs @@ -39,8 +39,8 @@ module Hledger.Utils.Parse ( skipNonNewlineSpaces', -- ** Trace the state of hledger parsers - traceOrLogParse, dbgparse, + traceOrLogParse, -- * re-exports HledgerParseErrors, @@ -72,6 +72,16 @@ type SimpleTextParser = Parsec HledgerParseErrorData Text -- XXX an "a" argumen -- | A parser of text that runs in some monad. type TextParser m a = ParsecT HledgerParseErrorData Text m a +-- class (Stream s, MonadPlus m) => MonadParsec e s m +-- dbgparse :: (MonadPlus m, MonadParsec e String m) => Int -> String -> m () + +-- | Trace to stderr or log to debug log the provided label (if non-null) +-- and current parser state (position and next input), +-- if the global debug level is at or above the specified level. +-- Uses unsafePerformIO. +dbgparse :: Int -> String -> TextParser m () +dbgparse level msg = when (level <= debugLevel) $ traceOrLogParse msg + -- | Trace to stderr or log to debug log the provided label (if non-null) -- and current parser state (position and next input). -- See also: Hledger.Utils.Debug, megaparsec's dbg. @@ -88,16 +98,6 @@ traceOrLogParse msg = do where peeklength = 30 --- class (Stream s, MonadPlus m) => MonadParsec e s m --- dbgparse :: (MonadPlus m, MonadParsec e String m) => Int -> String -> m () - --- | Trace to stderr or log to debug log the provided label (if non-null) --- and current parser state (position and next input), --- if the global debug level is at or above the specified level. --- Uses unsafePerformIO. -dbgparse :: Int -> String -> TextParser m () -dbgparse level msg = when (level <= debugLevel) $ traceOrLogParse msg - -- | Render a pair of source positions in human-readable form, only displaying the range of lines. sourcePosPairPretty :: (SourcePos, SourcePos) -> String sourcePosPairPretty (SourcePos fp l1 _, SourcePos _ l2 c2) =