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

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

Moduleghc-internal-9.1401.0Haskell2010

GHC.Internal.Text.ParserCombinators.ReadPrec

This library defines parser combinators for precedence parsing.

Contents
  1. Precedences
  2. Precedence operations
  3. Other operations
  4. Converters
Synopsis
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