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

Sterling Clover s.clover at
Sat Feb 9 19:23:56 EST 2008

This discussion has pretty much convinced me as well that readM would  
be a mistake at this point. As to whether maybeRead trims trailing  
whitespace though...?


On Feb 8, 2008, at 8:20 AM, Henning Thielemann wrote:

> On Fri, 8 Feb 2008, Aaron Denney wrote:
>> On 2008-02-08, Yitzchak Gale <gale at> wrote:
>>> I vote mildly in favor of maybeRead,
>>> strongly against readM.
>>> "fail" refers only to failure of pattern matching.
>>> The wart is that its name should have been
>>> more specific, like "patternFail". Using
>>> "fail" for a non-pattern-matching error is a
>>> bug, not just a wart, in my opinion.
>> Even if you do consider it a bug, it's an extremely useful bug.
>> I don't see the point in deprecating it until a truly usable  
>> alternative
>> is actually in the standard.
> If an alternative is added to the standard libraries, readM would  
> have to
> remain. I think the generalization is not useful enough to  
> introduce the
> monad version that we will regret later. readM can be added with  
> the right
> type, when the alternative appears. Until then maybeRead is fine.
> _______________________________________________
> Libraries mailing list
> Libraries at

More information about the Libraries mailing list