Proposal: Add Text.Read.maybeRead :: Read a => String -> Maybe a

John Meacham john at
Fri Feb 8 07:12:43 EST 2008

On Fri, Feb 08, 2008 at 11:39:18AM +0100, Henning Thielemann wrote:
> > say that next time you get a mysterious "fromJust: Nothing" error with
> > no context, error messages in haskell are quite an issue as is, _any_
> > useful information is good, passing them on to the user without
> > interpretation is loads better than not having any clue what went wrong.
> Since 'error' denotes a programming error, not an exception, there is no
> need that the user understands the error message. It is entirely the task
> of the programmer to understand the message or its absence and it would
> be completely ok if the program aborts with "the programmer made a
> mistake, please complain to him".

I am not sure what distinction you are making between the user and the
developer. I don't believe errors should be catchable at all and find
the ability to catch 'error' rather unaethetic. But I do believe they
should be absolutely as informative as possible in order to track down
bugs and the string argument is invaluable for that. I am not saying
that "users" will be happier seeing "readM: no parse" than "fromJust:
Nothing" as they both indicate bugs in your code, but getting a bug
report with the first is much more useful and more precise. Haskell is
hard enough to debug as is, we should take help wherever we can get it.


John Meacham - ⑆⑆john⑈

More information about the Libraries mailing list