[Haskell-cafe] Parsing of bytestrings with non-String errors?

Bryan O'Sullivan bos at serpentine.com
Mon Feb 22 13:44:32 EST 2010

On Sun, Feb 21, 2010 at 4:36 AM, Magnus Therning <magnus at therning.org>wrote:

> I've looked at polyparse and attoparsec and they seem to have in common
> that
> the error always is a String.  My current ideas for a project would be a
> lot
> easier if I could just return some other type, something that I can pattern
> match on.

It would be easy enough to add this, but you'd end up with a slightly
convoluted API. Because of the presence of fail in all monadic APIs, you'd
have to support only-a-string as a failure result in some form, so your
failure type would have to be something like Either String a.

There's no support for this in attoparsec simply because I haven't needed
it. I suspect the same is true of other libraries, nothing deeper.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100222/a3691937/attachment.html

More information about the Haskell-Cafe mailing list