projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update submodules for GHC.HetMet.GArrow -> Control.GArrow renaming
[ghc-hetmet.git]
/
compiler
/
utils
/
Util.lhs
diff --git
a/compiler/utils/Util.lhs
b/compiler/utils/Util.lhs
index
0e46889
..
dc4f32e
100644
(file)
--- a/
compiler/utils/Util.lhs
+++ b/
compiler/utils/Util.lhs
@@
-66,6
+66,9
@@
module Util (
-- * Floating point
readRational,
-- * Floating point
readRational,
+ -- * read helpers
+ maybeReadFuzzy,
+
-- * IO-ish utilities
createDirectoryHierarchy,
doesDirNameExist,
-- * IO-ish utilities
createDirectoryHierarchy,
doesDirNameExist,
@@
-966,6
+969,17
@@
readRational top_s
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
+-- read helpers
+
+maybeReadFuzzy :: Read a => String -> Maybe a
+maybeReadFuzzy str = case reads str of
+ [(x, s)]
+ | all isSpace s ->
+ Just x
+ _ ->
+ Nothing
+
+-----------------------------------------------------------------------------
-- Create a hierarchy of directories
createDirectoryHierarchy :: FilePath -> IO ()
-- Create a hierarchy of directories
createDirectoryHierarchy :: FilePath -> IO ()