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

Moduleproto-lens-0.7.1.5Haskell2010

Data.ProtoLens.Encoding.Parser

A custom parsing monad, optimized for speed.

  • 1 type
  • 8 values
newtypenewtype Parser a
#

A monad for parsing an input buffer.

Instances4Monad, Functor, MonadFail, Applicative
  • Monad ParserDefined in proto-lens-0.7.1.5 · Data.ProtoLens.Encoding.Parser.Internal
  • Functor ParserDefined in proto-lens-0.7.1.5 · Data.ProtoLens.Encoding.Parser.Internal
  • MonadFail ParserDefined in proto-lens-0.7.1.5 · Data.ProtoLens.Encoding.Parser.Internal
  • Applicative ParserDefined in proto-lens-0.7.1.5 · Data.ProtoLens.Encoding.Parser.Internal
valuerunParser :: Parser a -> ByteString -> Either String a
#

Evaluates a parser on the given input.

If the parser does not consume all of the input, the rest of the input is discarded and the parser still succeeds. Parsers may use atEnd to detect whether they are at the end of the input.

Values returned from actions in this monad will not hold onto the original ByteString, but rather make immutable copies of subsets of its bytes.

valueatEnd :: Parser Bool
#

Returns True if there is no more input left to consume.

valueisolate :: Int -> Parser a -> Parser a
#

Run the given parsing action as if there are only len bytes remaining. That is, once len bytes have been consumed, atEnd will return True and other actions like getWord8 will act like there is no input remaining.

Fails the parse if given a negative length.

valuegetBytes :: Int -> Parser ByteString
#

Parse a sequence of zero or more bytes of the given length.

The new ByteString is an immutable copy of the bytes in the input and will be managed separately on the Haskell heap from the original input ByteString.

Fails the parse if given a negative length.