:: Read a => String -> Maybe a -package:read-env-var

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
Safe read function. Defined here for convenience to use for parseValue.
Attempts to parse a value from the front of the string.
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
@since base-4.6.0.0
Reads a value encoded as a string, return Just the value or Nothing on error.
A read-based parser for the parser modifier.
A read that fails using mzero
Parse a string using the Read instance. Succeeds if there is exactly one valid result.
>>> readMaybe ("123" :: Text) :: Maybe Int
Just 123
>>> readMaybe ("hello" :: Text) :: Maybe Int
Nothing
Read in any monad.
Polymorhpic version of readMaybe.
>>> readMaybe @Int @Text "123"
Just 123

>>> readMaybe @Int @Text "aa"
Nothing
readM behaves like read, but catches failure in a monad. this allocates a 20-30 M on startup...
Parse a value to a Maybe result using a Read instance
A read with better error messages.
throws ExpectFailed. This is nice for writing your own abstractions.
A convenience function for throwing a user error. This is useful for cases where it would be too high a burden to define your own exception type. This throws an exception of type StringException. When GHC supports it (base 4.9 and GHC 8.0 and onward), it includes a call stack.