diff options
Diffstat (limited to 'compiler/utils/Util.lhs')
-rw-r--r-- | compiler/utils/Util.lhs | 7 |
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)] |