# On how to use the *pure* functions: read :: Read a => String -> a reads :: Read a => ReadS a What is this type ReadS a? Let's ask GHCi: GHCi> :info ReadS type ReadS a = String -> [(a, String)] To use read, we need to specify the type a: GHCi> read "123" :: Int 123 GHCi> read "123" :: Integer 123 GHCi> read "123" :: String "*** Exception: Prelude.read: no parse GHCi> read "\"123\"" :: String "123" GHCi> read "[12,3]" :: [Int] [12,3] To use reads, we also need to specify the type a: GHCi [Prelude]> reads "123hello" :: [(Integer, String)] [(123,"hello")] GHCi [Prelude]> reads "123hello" :: [(String, String)] [] What is this? When we evaluate reads x :: [(a, String)] it returns [] if it cannot parse x as a value of type a. Otherwise, it returns a singleton list [(v, rst)] where v :: a is the value parsed from the given string x, and rst is the remaining string.