diff options
Diffstat (limited to 'Utility/PartialPrelude.hs')
-rw-r--r-- | Utility/PartialPrelude.hs | 6 |
1 files changed, 3 insertions, 3 deletions
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 |