
2 Jun
2008
2 Jun
'08
7:07 p.m.
Hi
The best thing to do is bypass read and use 'reads' to define your own safe read.
maybeRead :: Read a => String -> Maybe a maybeRead s = case reads s of [(x, "")] -> Just x _ -> Nothing
Or just use the Safe package: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/safe http://hackage.haskell.org/packages/archive/safe/0.2/doc/html/Safe.html#v%3A... Thanks Neil