blob: 909dc9c9f095def4c2b39f6f8e071cdc4445f6b4 (
plain)
1
2
3
4
5
6
7
8
|
module Data.Maybe.Read (readMaybe) where
-- readMaybe function from "Learn You a Haskell"
readMaybe :: (Read a) => String -> Maybe a
readMaybe st = case reads st of
[(x,"")] -> Just x
_ -> Nothing
|