[Haskell-cafe] Embarrassed Haskeller -- why is Read so bad? What are alternatives?
Ryan Newton
rrnewton at gmail.com
Tue Oct 15 19:38:14 UTC 2013
Hmm, currently trying to learn how to incorporate DriFT into a cabal
package. Polyparse doesn't support any other deriving mechanisms does it?
(GHC.Generics, or TemplateHaskell based, or Neil Mitchell's "derive"
preprocessor?)
On Tue, Oct 15, 2013 at 3:01 PM, Ryan Newton <rrnewton at gmail.com> wrote:
> Thanks!
>
> That looks perfect and that is exactly what my googling failed to turn up.
>
>
>
>
> On Tue, Oct 15, 2013 at 11:49 AM, malcolm.wallace <malcolm.wallace at me.com>wrote:
>
>> The polyparse package has a complete drop-in replacement for Read, called
>> Text.Parse. Its lexer is derived closely from Haskell Prelude lex. It
>> already has instances for all of the standard datatypes, and you can use
>> DrIFT to generate instances for any datatypes outside the usual Prelude
>> types. The parser is fast, lazy, and space-efficient. It gives good error
>> messages.
>>
>> Regards,
>> Malcolm
>>
>>
>> On 15 Oct, 2013,at 04:01 PM, 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.
>>
>> 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".
>>
>> Argh!,
>> -Ryan
>>
>> _______________________________________________
>> 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/20131015/e7f02667/attachment.html>
More information about the Haskell-Cafe
mailing list