
7 Feb
2008
7 Feb
'08
3:18 p.m.
On Thu, 7 Feb 2008, Don Stewart wrote:
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.
Seems to be useful. May prevent people from using just 'read' while hoping that parsing will always succeed.