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

Twan van Laarhoven twanvl at
Fri Feb 8 15:35:34 EST 2008

David Menendez wrote:
>>Isn't the MonadPlus approach also by-default-safe?
> Safe, yes, but is it more useful?

Yes. In this case, take a parsing monad for example. You could write:

   parseInt :: CharParser () Int
   parseInt = do ds <- many digit
                 readM ds

And it would work automatically. A reading error would be propagated to the 
parser monad, and it would backtrack/report the error/whatever.


More information about the Libraries mailing list