Text.Read

| Haskell Core Libraries (base package) | Parent | Contents | Index
Text.Read |
Portability | portable
Stability | provisional
Maintainer | libraries@haskell.org
Contents
The `Read` class Haskell 98 functions New parsing functions
Description
The Text.Read library is the canonical library to import for `Read`-class facilities. It offers an extended and much improved `Read` class, which constitutes a proposed alternative to the Haskell98 `Read`. In particular, writing parsers is easier, and the parsers are much more efficient.
Synopsis
class Read a where
readListPrec :: ReadPrec [a]
readPrec :: ReadPrec a
readList :: ReadS [a]
readsPrec :: Int -> ReadS a
type ReadS a = String -> [(a, String)]
reads :: (Read a) => ReadS a
read :: (Read a) => String -> a
readParen :: Bool -> ReadS a -> ReadS a
lex :: ReadS String
module Text.ParserCombinators.ReadPrec
data Lexeme
= Char Char
| String String
| Punc String
| Ident String
| Symbol String
| Int Integer
| Rat Rational
| EOF
lexP :: ReadPrec Lexeme
readListDefault :: (Read a) => ReadS [a]
readListPrecDefault :: (Read a) => ReadPrec [a]
The `Read` class
class Read a where
Methods
readListPrec :: ReadPrec [a]
readPrec :: ReadPrec a
readList :: ReadS [a]
readsPrec :: Int -> ReadS a
Instances
Read CChar
Read CSChar
Read CUChar
Read CShort
Read CUShort
Read CInt
Read CUInt
Read CLong
Read CULong
Read CLLong
Read CULLong
Read CFloat
Read CDouble
Read CLDouble
Read CPtrdiff
Read CSize
Read CWchar
Read CSigAtomic
Read CClock
Read CTime
Read Int8
Read Int16
Read Int32
Read Int64
Read Char
Read Bool
Read Ordering
(Read a) => Read (Maybe a)
(Read a, Read b) => Read (Either a b)
(Read a) => Read [a]
(Ix a, Read a, Read b) => Read (Array a b)
Read Lexeme
Read Int
Read Integer
Read Float
Read Double
(Integral a, Read a) => Read (Ratio a)
Read ()
(Read a, Read b) => Read (a, b)
(Read a, Read b, Read c) => Read (a, b, c)
(Read a, Read b, Read c, Read d) => Read (a, b, c, d)
(Read a, Read b, Read c, Read d, Read e) => Read (a, b, c, d, e)
Read Word
Read Word8
Read Word16
Read Word32
Read Word64
Read StdGen
type ReadS a = String -> [(a, String)]
A parser for a type `a`, represented as a function that takes a `String` and returns a list of possible parses `(a,`String`)` pairs.
Haskell 98 functions
reads :: (Read a) => ReadS a
read :: (Read a) => String -> a
readParen :: Bool -> ReadS a -> ReadS a
lex :: ReadS String
New parsing functions
module Text.ParserCombinators.ReadPrec
data Lexeme
Constructors
Char Char |
String String |
Punc String |
Ident String |
Symbol String |
Int Integer |
Rat Rational |
EOF |
Instances
Read Lexeme
lexP :: ReadPrec Lexeme
Parse a single lexeme
readListDefault :: (Read a) => ReadS [a]
Use this to define the `readList` method, if you don't want a special case
readListPrecDefault :: (Read a) => ReadPrec [a]
Use this to define the `readListPrec` method, if you don't want a special case
Produced by Haddock version 0.3