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%3AreadMay

Thanks

Neil
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to