HORIZON HASKELLDocslts/ghc-9.14.x7a6c33e2026-10-12Search packagesCtrl K
Theme: |

GHC 9.14.1 · lts/ghc-9.14.x · 7a6c33e · 2026-10-12

Modulebase-4.22.0.0Haskell2010

Text.ParserCombinators.ReadPrec

This module defines parser combinators for precedence parsing.

Contents
  1. Precedences
  2. Precedence operations
  3. Other operations
  4. Converters
Synopsis
  • Packagebase-4.22.0.0
  • Exports17
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceReadPrec.hs
newtypenewtype ReadPrec a
#
Instances6Monad, Functor, MonadFail, Applicative, Alternative, MonadPlus
  • Monad ReadPrecDefined in ghc-internal-9.1401.0 · GHC.Internal.Text.ParserCombinators.ReadPrec
  • Functor ReadPrecDefined in ghc-internal-9.1401.0 · GHC.Internal.Text.ParserCombinators.ReadPrec
  • MonadFail ReadPrecDefined in ghc-internal-9.1401.0 · GHC.Internal.Text.ParserCombinators.ReadPrec
  • Applicative ReadPrecDefined in ghc-internal-9.1401.0 · GHC.Internal.Text.ParserCombinators.ReadPrec
  • Alternative ReadPrecDefined in ghc-internal-9.1401.0 · GHC.Internal.Text.ParserCombinators.ReadPrec
  • MonadPlus ReadPrecDefined in ghc-internal-9.1401.0 · GHC.Internal.Text.ParserCombinators.ReadPrec

Precedences

Precedence operations

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

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.

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