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

Utility functions for parsing and encoding individual types.

  • 2 types
  • 25 values

Running encodings

5 declarations
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
newtypenewtype Builder
#

Builders denote sequences of bytes. They are Monoids where mempty is the zero-length sequence and mappend is concatenation, which runs in O(1).

Instances6IsList, Show, IsString, Semigroup, Monoid, Item
  • IsList BuilderDefined in bytestring-0.12.2.0 · Data.ByteString.Builder.Internal

    For long or infinite lists use fromList because it uses LazyByteString otherwise use fromListN which uses StrictByteString.

  • Show BuilderDefined in bytestring-0.12.2.0 · Data.ByteString.Builder · orphan
  • IsString BuilderDefined in bytestring-0.12.2.0 · Data.ByteString.Builder · orphan
  • Semigroup BuilderDefined in bytestring-0.12.2.0 · Data.ByteString.Builder.Internal
  • Monoid BuilderDefined in bytestring-0.12.2.0 · Data.ByteString.Builder.Internal
  • type Item Builder = Word8Defined in bytestring-0.12.2.0 · Data.ByteString.Builder.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.

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.

Bytestrings

2 declarations
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.

Text

1 declaration

Integral types

7 declarations

Floating-point types

4 declarations

Signed types

4 declarations

Other utilities

4 declarations
valueatEnd :: Parser Bool
#

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

valuefoldMapBuilder :: Vector v a => (a -> Builder) -> v a -> Builder
#

Loop over the elements of a vector and concatenate the resulting Builders.

This function has been hand-tuned to perform better than a naive implementation using, e.g., Vector.foldr or a manual loop.