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

Jeff Polakow jeff.polakow at db.com
Fri Feb 8 13:24:30 EST 2008


Hello,

> readM with fail defaults to ioError for almost all Monads, and so admits
> many dangerous programs, which is against the intent of the proposal 
> in the first place.
> 
ioError is only in the IO monad and is catchable. I think the problem is 
when fail defaults to error which can be anywhere and is not catchable. 

> It seems with Conor's suggestion of a 
> 
>     maybeReturn :: MonadPlus m => Maybe a -> m a
>     maybeReturn = maybe mzero return
> 
> we can still have the by-default-safe maybeRead, that doesn't admit 
> exception throwing opportunities.
> 
Isn't the MonadPlus approach also by-default-safe?

-Jeff


---

This e-mail may contain confidential and/or privileged information. If you 
are not the intended recipient (or have received this e-mail in error) 
please notify the sender immediately and destroy this e-mail. Any 
unauthorized copying, disclosure or distribution of the material in this 
e-mail is strictly forbidden.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/libraries/attachments/20080208/47cc6c59/attachment.htm


More information about the Libraries mailing list