Just parse the human-readable string with another parser, to get the machine-readable error description ;) and don't forget to parse the error your error string parser produces too.
On Thu, Dec 8, 2011 at 10:39 PM, Iavor DiatchkiThe only thing that bothers me about this is the fact that the error
<iavor.diatchki@gmail.com> wrote:
> Hello,
>
> when writing simple String parsers, I find implementing this function
> over and over:
>
> readEither :: Read a => String -> Either String a
is a String; I don't think that's a very good type for errors, because
only humans can really effectively interpret it. I don't know whether
it's worth introducing a new sum type just for the different kinds of
read error.
Regardless, readMaybe is definitely a good idea, so +1 for that.
_______________________________________________
Libraries mailing list
Libraries@haskell.org
http://www.haskell.org/mailman/listinfo/libraries