The error messages could be improved significantly by simply altering the ”version” and ”filename” hints in the source code, e.g. by specifying in human-readable terms what a filename is, and what a version is. Parsec does have the <?> operator, too, but Parsec does not provide this very graphical demonstration of where parsing went wrong, it only reports the label itself, and, IIRC, the Char offset in the input String!
Another advantage of Megaparsec is native Text support; I don't find that it's particularly useful in this usecase, since FilePath is aliased to String.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
For comparison, this is how it might look with Megaparsec:
And in action you see one benefit of using Megaparsec over Parsec or regex-applicative: Superior error messages.
The error messages could be improved significantly by simply altering the
”version”
and”filename”
hints in the source code, e.g. by specifying in human-readable terms what a filename is, and what a version is. Parsec does have the<?>
operator, too, but Parsec does not provide this very graphical demonstration of where parsing went wrong, it only reports the label itself, and, IIRC, the Char offset in the input String!Another advantage of Megaparsec is native
Text
support; I don't find that it's particularly useful in this usecase, sinceFilePath
is aliased toString
.