HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleghc-internal-9.1003.0Haskell2010

GHC.Internal.Text.ParserCombinators.ReadPrec

This library defines parser combinators for precedence parsing.

  • 2 types
  • 15 values
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