summaryrefslogtreecommitdiff
path: root/libraries/ghc-boot/GHC
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-04-05 17:39:13 +0200
committerSylvain Henry <sylvain@haskus.fr>2020-04-18 20:04:46 +0200
commit15312bbb53f247c9ed2c5cf75100a9f44c1c7227 (patch)
tree8306dcc04a5b7c82464f903044dfdd589e7fdcd7 /libraries/ghc-boot/GHC
parent3ca52151881451ce5b3a7740d003e811b586140d (diff)
downloadhaskell-15312bbb53f247c9ed2c5cf75100a9f44c1c7227.tar.gz
Modules (#13009)
* SysTools * Parser * GHC.Builtin * GHC.Iface.Recomp * Settings Update Haddock submodule Metric Decrease: Naperian parsing001
Diffstat (limited to 'libraries/ghc-boot/GHC')
-rw-r--r--libraries/ghc-boot/GHC/Settings/Platform.hs (renamed from libraries/ghc-boot/GHC/Settings.hs)17
-rw-r--r--libraries/ghc-boot/GHC/Settings/Utils.hs15
2 files changed, 17 insertions, 15 deletions
diff --git a/libraries/ghc-boot/GHC/Settings.hs b/libraries/ghc-boot/GHC/Settings/Platform.hs
index fd0a0ef3ad..f97fff6b6f 100644
--- a/libraries/ghc-boot/GHC/Settings.hs
+++ b/libraries/ghc-boot/GHC/Settings/Platform.hs
@@ -11,14 +11,14 @@
--
-- The "0" suffix is because the caller will partially apply it, and that will
-- in turn be used a few more times.
-module GHC.Settings where
+module GHC.Settings.Platform where
import Prelude -- See Note [Why do we import Prelude here?]
import GHC.BaseDir
import GHC.Platform
+import GHC.Settings.Utils
-import Data.Char (isSpace)
import Data.Map (Map)
import qualified Data.Map as Map
@@ -93,16 +93,3 @@ readSetting0 settingsFile mySettings key = case Map.lookup key mySettings of
Just v -> Right v
Nothing -> Left $ "Failed to read " ++ show key ++ " value " ++ show xs
Nothing -> Left $ "No entry for " ++ show key ++ " in " ++ show settingsFile
-
------------------------------------------------------------------------------
--- read helpers
-
-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
diff --git a/libraries/ghc-boot/GHC/Settings/Utils.hs b/libraries/ghc-boot/GHC/Settings/Utils.hs
new file mode 100644
index 0000000000..1f1cd67030
--- /dev/null
+++ b/libraries/ghc-boot/GHC/Settings/Utils.hs
@@ -0,0 +1,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