blob: 1f1cd670301960211e28af6025ff4c18b5941e3e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
module GHC.Settings.Utils where
import Prelude -- See Note [Why do we import Prelude here?]
import Data.Char (isSpace)
maybeRead :: Read a => String -> Maybe a
maybeRead str = case reads str of
[(x, "")] -> Just x
_ -> Nothing
maybeReadFuzzy :: Read a => String -> Maybe a
maybeReadFuzzy str = case reads str of
[(x, s)] | all isSpace s -> Just x
_ -> Nothing
|