Wireform.Core.Decoder
Low-level decoder primitives. Most users go through the format-specific
wrappers (Wireform.Proto.Decode,
Wireform.MsgPack.Decode, …); this module is the
plumbing.
Synopsis
getVarint :: Decoder Word64getText :: Int -> Decoder TextwithTag :: Decoder Word64 -> (Word64 -> Decoder a) -> Decoder a
Primitives
Section titled “Primitives”getVarint :: Decoder Word64Source
Decode an LEB128-encoded varint. Allocation-free on the hot path.
getText :: Int -> Decoder TextSource
Read n bytes and validate as UTF-8.
Combinators
Section titled “Combinators”withTag :: Decoder Word64 -> (Word64 -> Decoder a) -> Decoder aSource
CPS-style tag dispatch. Read a wire tag, then run a continuation that knows what to do with each value (statically inlined by GHC).