Because the fail method is an abomination that should never have been included in the Monad class.

2008/2/7 Jeff Polakow <jeff.polakow@db.com>:

Hello,

Why not allow an arbitrary monad?

readM :: (Monad m, Read a) => String -> String -> m a
readM errMsg s = case reads s of
    [(x, "")] -> return x
    _ -> fail errMsg

-Jeff


libraries-bounces@haskell.org wrote on 02/07/2008 01:46:48 PM:


> This function is typically defined once per project. So its
> about time this safe variant of 'read' made it into the base.
>
>     maybeRead :: Read a => String -> Maybe a
>     maybeRead s = case reads s of
>         [(x, "")] -> Just x
>         _         -> Nothing
>
> Consideration period: 1 week.
>
> Patch to Text.Read attached.
>
> [attachment "maybeRead.patch" deleted by Jeff Polakow/db/dbcom]

> _______________________________________________
> Libraries mailing list
> Libraries@haskell.org
> http://www.haskell.org/mailman/listinfo/libraries

---

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.

_______________________________________________
Libraries mailing list
Libraries@haskell.org
http://www.haskell.org/mailman/listinfo/libraries