rename readMaybe to readish
a stricter (but also partial) readMaybe is getting added to base
This commit is contained in:
parent
5e172b43c4
commit
ba6088b249
9 changed files with 13 additions and 13 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue