[Haskell-cafe] Alternative instance for non-backtracking parsers
Peter Simons
simons at nospf.cryp.to
Fri Aug 31 14:55:33 UTC 2018
Hi Bryan,
> If parser combinators aren't great for "relatively standard" things
> such as CSV, then what *are* they good for?
there is no such thing as a "parser combinator library". There are many
different libraries for writing parsers, and these libraries each have
vastly different design goals. Attoparsec, for example, is specifically
designed to be fast, and I don't see any reason why it shouldn't be
possible to implement a high-performance CSV parsing library on top of
that package. In fact, I believe Cassava does exactly that.
Parsec and the newer Megaparsec, on the other hand, put more emphasis on
good error messages than an performance. Now, good error messages matter
when you're parsing a sophisticated input language with many different
non-trivial constructs, but for a CSV parser there's really not much to be
done in terms of "good error messages" because the syntax is so simple.
Therefore, Parsec might not be the best choice for that particular
use-case.
Anyway, I don't think that it makes much sense to talk about all those
libraries as if they were all the same and had all the same properties,
because they don't.
Best regards,
Peter
More information about the Haskell-Cafe
mailing list