[Haskell-cafe] Embarrassed Haskeller -- why is Read so bad? What are alternatives?

S. Doaitse Swierstra doaitse at swierstra.net
Thu Oct 17 12:19:38 UTC 2013

On Oct 15, 2013, at 17:05 , Brandon Allbery <allbery.b at gmail.com> wrote:

> On Tue, Oct 15, 2013 at 11:01 AM, Ryan Newton <rrnewton at gmail.com> wrote:
> We have great tools for [de]serializing both to binary and to JSON (binary, cereal, json, aeson, etc).  But we have rather weak support for [de]serializing to human readable Haskell-ish external formats.
> What we have is parsec, attoparsec, trifecta, etc. --- parsers are so trivial to build in Haskell that it's easier to swot up one that does exactly what you need on the fly than it is to build a better Read with enough flexibility to cover a majority of use cases.

In feel free to completely disagree; it is easy to write a simple parser package, but designing one which gives nice error messages, corrects input instead of halting, can deal with ambiguous grammars, does not hang on to the input and produces results online wherever possible is not so easy.

By the way: the http://hackage.haskell.org/package/ChristmasTree package contains template Haskell code which can be used to read printed Haskell data type valyes in LINEAR TIME, and knows how to deal with infix constructors without havimng to include swarms of extra parentheses which make the trivial parsers take exponential time.


> -- 
> brandon s allbery kf8nh                               sine nomine associates
> allbery.b at gmail.com                                  ballbery at sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20131017/4c3a9f83/attachment.html>

More information about the Haskell-Cafe mailing list