Text.ParserCombinators.ReadP

| Haskell Core Libraries (base package) | Parent | Contents | Index
Text.ParserCombinators.ReadP |
Portability | portable
Stability | provisional
Maintainer | libraries@haskell.org
Contents
The `ReadP` type Primitive operations Other operations Conversions
Description
ReadP is a library of parser combinators, originally written by Koen Claessen. It parses all alternatives in parallel, so it never keeps hold of the beginning of the input string, a common source of space leaks with other parsers. The '(+++)' choice combinator is genuinely commutative; it makes no difference which branch is shorter.
Synopsis
data ReadP a
get :: ReadP Char
look :: ReadP String
(+++) :: ReadP a -> ReadP a -> ReadP a
gather :: ReadP a -> ReadP (String, a)
pfail :: ReadP a
satisfy :: (Char -> Bool) -> ReadP Char
char :: Char -> ReadP Char
string :: String -> ReadP String
munch :: (Char -> Bool) -> ReadP String
munch1 :: (Char -> Bool) -> ReadP String
skipSpaces :: ReadP ()
choice :: [ReadP a] -> ReadP a
readP_to_S :: ReadP a -> ReadS a
readS_to_P :: ReadS a -> ReadP a
The `ReadP` type
data ReadP a
Instances
Functor ReadP
Monad ReadP
MonadPlus ReadP
Primitive operations
get :: ReadP Char
look :: ReadP String
(+++) :: ReadP a -> ReadP a -> ReadP a
gather :: ReadP a -> ReadP (String, a)
Transforms a parser into one that does the same, but in addition returns the exact characters read. IMPORTANT NOTE: `gather` gives a runtime error if its first argument is built using any occurrences of readS_to_P.
Other operations
pfail :: ReadP a
satisfy :: (Char -> Bool) -> ReadP Char
char :: Char -> ReadP Char
string :: String -> ReadP String
munch :: (Char -> Bool) -> ReadP String
munch1 :: (Char -> Bool) -> ReadP String
skipSpaces :: ReadP ()
choice :: [ReadP a] -> ReadP a
Conversions
readP_to_S :: ReadP a -> ReadS a
readS_to_P :: ReadS a -> ReadP a
Produced by Haddock version 0.4