mrkkrp / megaparsec

Industrial-strength monadic parser combinator library
Other
910 stars 85 forks source link

tracing-megaparsec #500

Open yaitskov opened 1 year ago

yaitskov commented 1 year ago

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.

mrkkrp commented 1 year ago

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

yaitskov commented 1 year ago

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

mrkkrp commented 1 year ago

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