PROPOSAL: Export "readEither" from Text.Read

Ben Millwood haskell at
Mon Dec 12 16:24:35 CET 2011

On Thu, Dec 8, 2011 at 10:39 PM, Iavor Diatchki
<iavor.diatchki at> wrote:
> Hello,
> when writing simple String parsers, I find implementing this function
> over and over:
> readEither :: Read a => String -> Either String a

The only thing that bothers me about this is the fact that the error
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.

More information about the Libraries mailing list