summaryrefslogtreecommitdiff
path: root/compiler/utils/Util.lhs
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2011-10-19 13:32:11 +0100
committerIan Lynagh <igloo@earth.li>2011-10-19 14:10:21 +0100
commit38c8b565ff8d8011e26af8ae4b03800ca29d3f38 (patch)
tree4c39b6a15d61bc551845d4e1423b28995e1a6257 /compiler/utils/Util.lhs
parent013a3e3b79a86e377c6c94b34f6313d58363c6b3 (diff)
downloadhaskell-38c8b565ff8d8011e26af8ae4b03800ca29d3f38.tar.gz
Put the target platform in the settings file
Diffstat (limited to 'compiler/utils/Util.lhs')
-rw-r--r--compiler/utils/Util.lhs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/utils/Util.lhs b/compiler/utils/Util.lhs
index f7d3361267..dccb52dbb7 100644
--- a/compiler/utils/Util.lhs
+++ b/compiler/utils/Util.lhs
@@ -69,7 +69,7 @@ module Util (
readRational,
-- * read helpers
- maybeReadFuzzy,
+ maybeRead, maybeReadFuzzy,
-- * IO-ish utilities
createDirectoryHierarchy,
@@ -989,6 +989,11 @@ readRational top_s
-----------------------------------------------------------------------------
-- 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)]