Copyright | © 2015–present Megaparsec contributors |
---|---|
License | FreeBSD |
Maintainer | Mark Karpov <markkarpov92@gmail.com> |
Stability | experimental |
Portability | portable |
Safe Haskell | Unsafe |
Language | Haskell2010 |
Debugging helpers.
Since: 7.0.0
Synopsis
- class MonadParsec e s m => MonadParsecDbg e s m where
- dbg' :: MonadParsecDbg e s m => String -> m a -> m a
Documentation
class MonadParsec e s m => MonadParsecDbg e s m where Source #
Type class describing parser monads that can trace during evaluation.
Since: 9.3.0
parser works exactly like dbg
label pp
, but when it's evaluated
it prints information useful for debugging. The label
is only used to
refer to this parser in the debugging output. This combinator uses the
trace
function from Debug.Trace under the hood.
Typical usage is to wrap every sub-parser in misbehaving parser with
dbg
assigning meaningful labels. Then give it a shot and go through the
print-out. As of current version, this combinator prints all available
information except for hints, which are probably only interesting to
the maintainer of Megaparsec itself and may be quite verbose to output in
general. Let me know if you would like to be able to see hints in the
debugging output.
The output itself is pretty self-explanatory, although the following abbreviations should be clarified (they are derived from the low-level source code):
COK
—“consumed OK”. The parser consumed input and succeeded.CERR
—“consumed error”. The parser consumed input and failed.EOK
—“empty OK”. The parser succeeded without consuming input.EERR
—“empty error”. The parser failed without consuming input.
Note: up until the version 9.3.0 this was a non-polymorphic
function that worked only in ParsecT
. It was first introduced in the
version 7.0.0.
Instances
MonadParsecDbg e s m => MonadParsecDbg e s (IdentityT m) Source # | |
MonadParsecDbg e s m => MonadParsecDbg e s (ReaderT r m) Source # | |
(Show st, MonadParsecDbg e s m) => MonadParsecDbg e s (StateT st m) Source # |
|
(Show st, MonadParsecDbg e s m) => MonadParsecDbg e s (StateT st m) Source # |
|
(Monoid w, Show w, MonadParsecDbg e s m) => MonadParsecDbg e s (WriterT w m) Source # |
|
(Monoid w, Show w, MonadParsecDbg e s m) => MonadParsecDbg e s (WriterT w m) Source # |
|
(VisualStream s, ShowErrorComponent e) => MonadParsecDbg e s (ParsecT e s m) Source # | |
(Monoid w, Show w, Show st, MonadParsecDbg e s m) => MonadParsecDbg e s (RWST r w st m) Source # |
|
(Monoid w, Show w, Show st, MonadParsecDbg e s m) => MonadParsecDbg e s (RWST r w st m) Source # |
|