base-3.0.2.0: Basic librariesSource codeContentsIndex
Text.ParserCombinators.ReadPrec
Portabilitynon-portable (uses Text.ParserCombinators.ReadP)
Stabilityprovisional
Maintainerlibraries@haskell.org
Contents
Precedences
Precedence operations
Other operations
Converters
Description
This library defines parser combinators for precedence parsing.
Synopsis
data ReadPrec a
type Prec = Int
minPrec :: Prec
lift :: ReadP a -> ReadPrec a
prec :: Prec -> ReadPrec a -> ReadPrec a
step :: ReadPrec a -> ReadPrec a
reset :: ReadPrec a -> ReadPrec a
get :: ReadPrec Char
look :: ReadPrec String
(+++) :: ReadPrec a -> ReadPrec a -> ReadPrec a
(<++) :: ReadPrec a -> ReadPrec a -> ReadPrec a
pfail :: ReadPrec a
choice :: [ReadPrec a] -> ReadPrec a
readPrec_to_P :: ReadPrec a -> Int -> ReadP a
readP_to_Prec :: (Int -> ReadP a) -> ReadPrec a
readPrec_to_S :: ReadPrec a -> Int -> ReadS a
readS_to_Prec :: (Int -> ReadS a) -> ReadPrec a
Documentation
data ReadPrec aSource
show/hide Instances
Precedences
type Prec = IntSource
minPrec :: PrecSource
Precedence operations
lift :: ReadP a -> ReadPrec aSource
Lift a precedence-insensitive ReadP to a ReadPrec.
prec :: Prec -> ReadPrec a -> ReadPrec aSource

(prec n p) checks whether the precedence context is less than or equal to n, and

  • if not, fails
  • if so, parses p in context n.
step :: ReadPrec a -> ReadPrec aSource
Increases the precedence context by one.
reset :: ReadPrec a -> ReadPrec aSource
Resets the precedence context to zero.
Other operations
All are based directly on their similarly-named ReadP counterparts.
get :: ReadPrec CharSource
Consumes and returns the next character. Fails if there is no input left.
look :: ReadPrec StringSource
Look-ahead: returns the part of the input that is left, without consuming it.
(+++) :: ReadPrec a -> ReadPrec a -> ReadPrec aSource
Symmetric choice.
(<++) :: ReadPrec a -> ReadPrec a -> ReadPrec aSource
Local, exclusive, left-biased choice: If left parser locally produces any result at all, then right parser is not used.
pfail :: ReadPrec aSource
Always fails.
choice :: [ReadPrec a] -> ReadPrec aSource
Combines all parsers in the specified list.
Converters
readPrec_to_P :: ReadPrec a -> Int -> ReadP aSource
readP_to_Prec :: (Int -> ReadP a) -> ReadPrec aSource
readPrec_to_S :: ReadPrec a -> Int -> ReadS aSource
readS_to_Prec :: (Int -> ReadS a) -> ReadPrec aSource
Produced by Haddock version 0.9