Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

15 lines (10 sloc) 0.378 kB
module MaybeRead where
import Data.List(find)
import Text.Read
import Text.ParserCombinators.ReadP
readMaybe :: Read a => String -> Maybe a
readMaybe = readsMaybe reads
readsMaybe :: ReadS a -> String -> Maybe a
readsMaybe func str = maybe Nothing (\x->Just (fst x)) (find (null.snd) (func str))
readPMaybe :: ReadP a -> String -> Maybe a
readPMaybe = readsMaybe.readP_to_S
Jump to Line
Something went wrong with that request. Please try again.