:: Read a => String -> Maybe a package:base-prelude

Parse a string using the Read instance. Succeeds if there is exactly one valid result.
>>> readMaybe "123" :: Maybe Int
Just 123
>>> readMaybe "hello" :: Maybe Int
Nothing
The type-safe cast operation