reads package:base
equivalent to
readsPrec with a precedence of 0.
A parser for a type
a, represented as a function that takes a
String and returns a list of possible parses as
(a,String) pairs.
Note that this kind of backtracking parser is very inefficient;
reading a large structure may be quite slow (cf
ReadP).
attempts to parse a value from the front of the string, returning a
list of (parsed value, remaining string) pairs. If there is no
successful parse, the returned list is empty.
Derived instances of
Read and
Show satisfy the
following:
That is,
readsPrec parses the string produced by
showsPrec, and delivers the value that
showsPrec started
with.
readsBinaryWith rp1 rp2 n c n' matches the name of a
binary data constructor and then parses its arguments using
rp1 and
rp2 respectively.
readsData p d is a parser for datatypes where each
alternative begins with a data constructor. It parses the constructor
and passes it to
p. Parsers for various constructors can be
constructed with
readsUnary,
readsUnary1 and
readsBinary1, and combined with
mappend from the
Monoid class.
Lift the standard
readsPrec function through the type
constructor.
readsUnaryWith rp n c n' matches the name of a unary
data constructor and then parses its argument using
rp.
Read the value of an
STRef
Reads a
signed Real value, given a reader for an
unsigned value.
Converts a Haskell ReadS-style function into a parser. Warning: This
introduces local backtracking in the resulting parser, and therefore a
possible inefficiency.
Read a
StablePtr# value from mutable array; offset in machine
words.
Warning: this can fail with an unchecked exception.
Read a
StablePtr# value from mutable address; offset in machine
words.
On some platforms, the access may fail for an insufficiently aligned
Addr#.
Warning: this can fail with an unchecked exception.
Read parser for a symbol record field, of the form
(###)=value (where
### is the field name). The field
name must be a symbol (operator-style), e.g.
(#). For regular
(alphanumeric) field names, use
readField. The second argument
is a parser for the field value.
Returns an STM action that can be used to wait for data to read from a
file descriptor. The second returned value is an IO action that can be
used to deregister interest in the file descriptor.