summaryrefslogtreecommitdiff
path: root/Utility
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-01-23 17:00:10 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-01-23 17:00:10 -0400
commitba6088b249902d456177af3c14f20f43b6def1fd (patch)
tree43bd6cf141c63693732d4066c0d9590c0c077822 /Utility
parent5e172b43c4dc5d779e4f1af5c1376c9a8ebc60a4 (diff)
rename readMaybe to readish
a stricter (but also partial) readMaybe is getting added to base
Diffstat (limited to 'Utility')
-rw-r--r--Utility/Format.hs2
-rw-r--r--Utility/PartialPrelude.hs6
2 files changed, 4 insertions, 4 deletions
diff --git a/Utility/Format.hs b/Utility/Format.hs
index d8b7e4549..79e94ae96 100644
--- a/Utility/Format.hs
+++ b/Utility/Format.hs
@@ -88,7 +88,7 @@ gen = filter (not . empty) . fuse [] . scan [] . decode_c
| c == '}' = foundvar f var (readjustify $ reverse p) cs
| otherwise = inpad (c:p) f var cs
inpad p f var [] = Const (novar $ p++";"++var) : f
- readjustify = getjustify . fromMaybe 0 . readMaybe
+ readjustify = getjustify . fromMaybe 0 . readish
getjustify i
| i == 0 = UnJustified
| i < 0 = LeftJustified (-1 * i)
diff --git a/Utility/PartialPrelude.hs b/Utility/PartialPrelude.hs
index dbdf4fa5c..6efa093fd 100644
--- a/Utility/PartialPrelude.hs
+++ b/Utility/PartialPrelude.hs
@@ -10,7 +10,7 @@ module Utility.PartialPrelude where
import qualified Data.Maybe
{- read should be avoided, as it throws an error
- - Instead, use: readMaybe -}
+ - Instead, use: readish -}
read :: Read a => String -> a
read = Prelude.read
@@ -42,8 +42,8 @@ last = Prelude.last
- readMaybe is available in Text.Read in new versions of GHC,
- but that one requires the entire string to be consumed.
-}
-readMaybe :: Read a => String -> Maybe a
-readMaybe s = case reads s of
+readish :: Read a => String -> Maybe a
+readish s = case reads s of
((x,_):_) -> Just x
_ -> Nothing