HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulebase-4.20.2.0Haskell2010

Text.ParserCombinators.ReadPrec

This module defines parser combinators for precedence parsing.

  • 2 types
  • 15 values
  • Packagebase-4.20.2.0
  • Exports17
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceReadPrec.hs
newtypenewtype ReadPrec a
#
Instances6Monad, Functor, MonadFail, Applicative, Alternative, MonadPlus
  • Monad ReadPrecDefined in ghc-internal-9.1003.0 · GHC.Internal.Text.ParserCombinators.ReadPrec
  • Functor ReadPrecDefined in ghc-internal-9.1003.0 · GHC.Internal.Text.ParserCombinators.ReadPrec
  • MonadFail ReadPrecDefined in ghc-internal-9.1003.0 · GHC.Internal.Text.ParserCombinators.ReadPrec
  • Applicative ReadPrecDefined in ghc-internal-9.1003.0 · GHC.Internal.Text.ParserCombinators.ReadPrec
  • Alternative ReadPrecDefined in ghc-internal-9.1003.0 · GHC.Internal.Text.ParserCombinators.ReadPrec
  • MonadPlus ReadPrecDefined in ghc-internal-9.1003.0 · GHC.Internal.Text.ParserCombinators.ReadPrec

Precedences

2 declarations

Precedence operations

4 declarations
valueprec :: Prec -> ReadPrec a -> ReadPrec a
#

(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.

Other operations

6 declarations

All are based directly on their similarly-named ReadP counterparts.

valueget :: ReadPrec Char
#

Consumes and returns the next character. Fails if there is no input left.

valuelook :: ReadPrec String
#

Look-ahead: returns the part of the input that is left, without consuming it.

value(<++) :: ReadPrec a -> ReadPrec a -> ReadPrec a
#

Local, exclusive, left-biased choice: If left parser locally produces any result at all, then right parser is not used.

Converters

4 declarations