[Haskell-cafe] Embarrassed Haskeller -- why is Read so bad? What are alternatives?
rrnewton at gmail.com
Tue Oct 15 15:01:42 UTC 2013
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.
Read instances are both (1) slow, because they take Strings, and (2) they
don't allow sensible error messages! (Historical decision choosing Maybe
rather than Either.)
Right now I'm working on a project with a Racketeer who is trying to read a
6000 line file as a single list data structure. The derived Read instance
is just telling him it won't parse, with NO error information, line number
etc. To someone used to Scheme readers, that's rather poor.
I wish I had something better to tell him! I am not aware of a library to
recommend other than switching to JSON format on disk. OR manually
kludging together a parsing hack that, for example, puts one element of the
list on each line and makes much smaller calls to "read".
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe