Proposal: Add Text.Read.maybeRead :: Read a => String -> Maybe a
John Meacham
john at repetae.net
Thu Feb 14 15:21:12 EST 2008
On Fri, Feb 08, 2008 at 09:35:34PM +0100, Twan van Laarhoven wrote:
> 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.
Yes. this is exactly the sort of thing I use this for. (I have had readM
in my standard toolkit for a while).
John
--
John Meacham - ⑆repetae.net⑆john⑈
More information about the Libraries
mailing list