mrkkrp/megaparsec

tracing-megaparsec

yaitskov opened this issue · 3 comments

Hi,

I saw there is Text.Megaparsec.Debug. It has same problem as manual printf - it is expensive to add log statements, to keep them and remove, because it requires manual labor.

Parser built with the library is not transparent enough for debugging.
Transparency is expensive for production.

I would like to have automatic tracer capability. All combinators log name (type, char expected), current position and a few chars from input before attempt to parse into additional state field which is return together with error.

Overhead for production is solved by locating all combinators with tracing capability into separate cabal package, let say tracing-megaparsec. Then it is easy to flip package in cabal with flag and select failing test to run.

Well, you are certainly welcome to write such a package!

Parsec/Megaparsec have long history. Am I going to be the first in such attempt?

I'm not aware of anything like this already existing.