:: Read a => String -> Maybe a

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.
Just like readEnvEx, but also throw an exception when the environment variable cannot be read. This can throw both EnvVarCannotBeReadException and EnvVarDoesNotExistException with throwM. Read an environment variable that exists:
>>> setEnv "TEST_ENV_VAR" "2000"

>>> readEnvEx' "TEST_ENV_VAR" :: IO Int
2000
Try reading an environment variable that does not exist. Throws EnvVarDoesNotExistException:
>>> readEnvEx' "THIS_ENV_VAR_WILL_NOT_EXIST" :: IO Int
*** Exception: EnvVarDoesNotExistException "THIS_ENV_VAR_WILL_NOT_EXIST"
Try reading an environment variable that cannot be read. Throws EnvVarCannotBeReadException:
>>> setEnv "BAD_ENV_VAR" "not an int"

>>> readEnvEx' "BAD_ENV_VAR" :: IO Int
*** Exception: EnvVarCannotBeReadException "BAD_ENV_VAR"
Note that this DOES NOT read string values as one might expect:
>>> setEnv "TEST_ENV_VAR2" "some string 1"

>>> readEnvEx' "TEST_ENV_VAR2" :: IO String
*** Exception: EnvVarCannotBeReadException "TEST_ENV_VAR2"
It will read string values as if they were Haskell strings:
>>> setEnv "TEST_ENV_VAR3" "\"some string 1\""

>>> readEnvEx' "TEST_ENV_VAR3" :: IO String
"some string 1"
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.