‘Text.Megaparsec.Prim’ cannot be considered portable since it uses
multi-parameter type classes and functional dependencies.
Other modules that depend on these non-portable features from
‘Text.Megaparsec.Prim’ should be considered non-portable too.
Closes#37.
Most part of these changes is proposed by @neongreen. To apply precisely
what I deem acceptable, correct some of them in other way, and add some
other things, I've manually re-edited this.
Closes#35.
Since ‘many’ (and thus ‘some’) are the only combinator that can succeed
consuming input and produce hints at the same time we can conclude that
‘cok'’ continuation in ‘pLabel’ combinator is only called when ‘many’ is
labelled. By correcting label in this case prepending the phrase “rest
of ” to actual label we can greatly improve result error message.
Close # 27.
Backtracking user state can be achieved via combination of ‘StateT’
monad transformer and ‘ParsecT’:
StateT StateType (ParsecT s m a)
This user state can be more flexible. This fact renders current built-in
user state redundant.
To help work with this new approach (combining monad transformers more
freely) we introduce ‘MonadParsec’ MTL-style type class. All tools that
come with Megaparsec library were modified to work smoothly with any
instance of ‘MonadParsec’, not only ‘ParsecT’.
Various languages may vary in how hexadecimal and octal literals should
be prefixed. Following the spirit of the new lexer we leave this to
programmer to decide.
Eliminated ‘Text.Megaparsec.Language’ module because at this point it is
clear that already existing definitions are of little use in
Megaparsec. I started writing “default” language definition in
‘Text.Megaparsec.Lexer’.
At this point it should be possible to parse languages where indentation
matters, although we will need to provide more helpers to make it
easier.