-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Nonresumable byte parser -- -- Parse bytes as fast as possible. This is a nonresumable parser that -- aggresively uses UnboxedSums to avoid performing any -- allocations. @package bytesmith @version 0.3.4.0 -- | Everything in this module is unsafe and can lead to nondeterministic -- output or segfaults if used incorrectly. module Data.Bytes.Parser.Unsafe -- | A non-resumable parser. newtype Parser :: forall (r :: RuntimeRep). Type -> Type -> TYPE r -> Type [Parser] :: forall (r :: RuntimeRep) (e :: Type) (s :: Type) (a :: TYPE r). {runParser :: (# ByteArray#, Int#, Int# #) -> ST# s (Result# e a)} -> Parser e s a -- | Get the current offset into the chunk. Using this makes it possible to -- observe the internal difference between Bytes that refer to -- equivalent slices. Be careful. cursor :: Parser e s Int -- | Return the byte array being parsed. This includes bytes that preceed -- the current offset and may include bytes that go beyond the length. -- This is somewhat dangerous, so only use this is you know what you're -- doing. expose :: Parser e s ByteArray -- | Move the cursor back by n bytes. Precondition: you must have -- previously consumed at least n bytes. unconsume :: Int -> Parser e s () -- | Set the position to the given index. Precondition: the index must be -- valid. It should be the result of an earlier call to cursor. jump :: Int -> Parser e s () -- | Parse non-resumable sequence of bytes. To parse a byte sequence as -- text, use the Ascii, Latin, and Utf8 -- modules instead. Functions for parsing decimal-encoded numbers are -- found in those modules. module Data.Bytes.Parser -- | A non-resumable parser. data Parser :: forall (r :: RuntimeRep). Type -> Type -> TYPE r -> Type -- | The result of running a parser. data Result e a -- | An error message indicating what went wrong. Failure :: e -> Result e a -- | The parsed value and the number of bytes remaining in parsed slice. Success :: {-# UNPACK #-} !Slice a -> Result e a -- | Slicing metadata (an offset and a length) accompanied by a value. This -- does not represent a slice into the value. This type is intended to be -- used as the result of an executed parser. In this context the slicing -- metadata describe a slice into to the array (or byte array) that from -- which the value was parsed. -- -- It is often useful to check the length when a parser succeeds -- since a non-zero length indicates that there was additional unconsumed -- input. The offset is only ever needed to construct a new -- slice (via Bytes or SmallVector) from the remaining -- input. data Slice a Slice :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> a -> Slice a -- | Variant of parseBytes that accepts an unsliced -- ByteArray. parseByteArray :: (forall s. Parser e s a) -> ByteArray -> Result e a -- | Parse a byte sequence. This can succeed even if the entire slice was -- not consumed by the parser. parseBytes :: forall e a. (forall s. Parser e s a) -> Bytes -> Result e a -- | Variant of parseBytes that allows the parser to be run as part -- of an existing effectful context. parseBytesEffectfully :: Parser e s a -> Bytes -> ST s (Result e a) -- | Variant of parseBytes that discards the new offset and the -- remaining length. This does not, however, require the remaining length -- to be zero. Use endOfInput to accomplish that. parseBytesEither :: forall e a. (forall s. Parser e s a) -> Bytes -> Either e a -- | Variant of parseBytesEither that discards the error message on -- failure. Just like parseBytesEither, this does not impose any -- checks on the length of the remaining input. parseBytesMaybe :: forall e a. (forall s. Parser e s a) -> Bytes -> Maybe a -- | Consumes and returns the next byte in the input. Fails if no -- characters are left. any :: e -> Parser e s Word8 -- | Take the given number of bytes. Fails if there is not enough remaining -- input. take :: e -> Int -> Parser e s Bytes -- | Take while the predicate is matched. This is always inlined. takeWhile :: (Word8 -> Bool) -> Parser e s Bytes -- | Take bytes until the specified byte is encountered. Consumes the -- matched byte as well. Fails if the byte is not present. Visually, the -- cursor advancement and resulting Bytes for takeTrailedBy -- 0x19 look like this: -- --
-- 0x10 0x13 0x08 0x15 0x19 0x23 0x17 | input
-- |---->---->---->---->----| | cursor
-- {----*----*----*----} | result bytes
--
takeTrailedBy :: e -> Word8 -> Parser e s Bytes
-- | Skip while the predicate is matched. This is always inlined.
skipWhile :: (Word8 -> Bool) -> Parser e s ()
-- | Skip all characters until the character from the is encountered and
-- then consume the matching byte as well.
skipTrailedBy :: e -> Word8 -> Parser e s ()
byteArray :: e -> ByteArray -> Parser e s ()
bytes :: e -> Bytes -> Parser e s ()
-- | The parser satisfy p succeeds for any byte for which the
-- predicate p returns True. Returns the byte that is
-- actually parsed.
satisfy :: e -> (Word8 -> Bool) -> Parser e s Word8
-- | The parser satisfyWith f p transforms a byte, and succeeds if
-- the predicate p returns True on the transformed value.
-- The parser returns the transformed byte that was parsed.
satisfyWith :: e -> (Word8 -> a) -> (a -> Bool) -> Parser e s a
-- | Fails if there is still more input remaining.
endOfInput :: e -> Parser e s ()
-- | Returns true if there are no more bytes in the input. Returns false
-- otherwise. Always succeeds.
isEndOfInput :: Parser e s Bool
-- | Consume all remaining bytes in the input.
remaining :: Parser e s Bytes
-- | A stateful scanner. The predicate consumes and transforms a state
-- argument, and each transformed state is passed to successive
-- invocations of the predicate on each byte of the input until one
-- returns Nothing or the input ends.
--
-- This parser does not fail. It will return the initial state if the
-- predicate returns Nothing on the first byte of input.
--
-- Note: Because this parser does not fail, do not use it with
-- combinators such a many, because such parsers loop until a
-- failure occurs. Careless use will thus result in an infinite loop.
scan :: state -> (state -> Word8 -> Maybe state) -> Parser e s state
-- | Match any byte, to perform lookahead. Returns Nothing if end of
-- input has been reached. Does not consume any input.
--
-- Note: Because this parser does not fail, do not use it with
-- combinators such as many, because such as many,
-- because such parsers loop until a failure occurs. Careless use will
-- thus result in an infinite loop.
peek :: Parser e s (Maybe Word8)
-- | Match any byte, to perform lookahead. Does not consume any input, but
-- will fail if end of input has been reached.
peek' :: e -> Parser e s Word8
-- | Fail with the provided error message.
fail :: e -> Parser e s a
-- | There is a law-abiding instance of Alternative for
-- Parser. However, it is not terribly useful since error messages
-- seldom have a Monoid instance. This function is a variant of
-- <|> that is right-biased in its treatment of error
-- messages. Consequently, orElse lacks an identity. See
-- attoparsec issue #122 for more discussion of this topic.
orElse :: Parser x s a -> Parser e s a -> Parser e s a
infixl 3 `orElse`
-- | Annotate a parser. If the parser fails, the error will be returned.
annotate :: Parser x s a -> e -> Parser e s a
-- | Infix version of annotate.
(>) :: Parser x s a -> e -> Parser e s a
infix 0 >
-- | Replicate a parser n times, writing the results into an array
-- of length n. For Array and SmallArray, this
-- is lazy in the elements, so be sure the they result of the parser is
-- evaluated appropriately to avoid unwanted thunks.
replicate :: forall arr e s a. (Contiguous arr, Element arr a) => Int -> Parser e s a -> Parser e s (arr a)
-- | Run a parser in a delimited context, failing if the requested number
-- of bytes are not available or if the delimited parser does not consume
-- all input. This combinator can be understood as a composition of
-- take, effect, parseBytesEffectfully, and
-- endOfInput. It is provided as a single combinator because for
-- convenience and because it is easy to make mistakes when manually
-- assembling the aforementioned parsers. The pattern of prefixing an
-- encoding with its length is common. This is discussed more in
-- attoparsec issue #129.
--
-- -- delimit e1 e2 n remaining === take e1 n --delimit :: e -> e -> Int -> Parser e s a -> Parser e s a -- | Augment a parser with the number of bytes that were consume while it -- executed. measure :: Parser e s a -> Parser e s (Int, a) -- | Lift an effectful computation into a parser. effect :: ST s a -> Parser e s a -- | Convert a Word# parser to a Word32 parser. Precondition: -- the argument parser only returns words less than 4294967296. boxWord32 :: Parser e s Word# -> Parser e s Word32 -- | Convert a (, Int) parser to a (Int,Int) parser. boxIntPair :: Parser e s (# Int#, Int# #) -> Parser e s (Int, Int) -- | Convert a Word32 parser to a Word# parser. unboxWord32 :: Parser e s Word32 -> Parser e s Word# -- | Convert a (Int,Int) parser to a (, Int) parser. unboxIntPair :: Parser e s (Int, Int) -> Parser e s (# Int#, Int# #) bindFromCharToLifted :: Parser s e Char# -> (Char# -> Parser s e a) -> Parser s e a bindFromLiftedToIntPair :: Parser s e a -> (a -> Parser s e (# Int#, Int# #)) -> Parser s e (# Int#, Int# #) bindFromLiftedToInt :: Parser s e a -> (a -> Parser s e Int#) -> Parser s e Int# bindFromIntToIntPair :: Parser s e Int# -> (Int# -> Parser s e (# Int#, Int# #)) -> Parser s e (# Int#, Int# #) bindFromCharToIntPair :: Parser s e Char# -> (Char# -> Parser s e (# Int#, Int# #)) -> Parser s e (# Int#, Int# #) bindFromMaybeCharToIntPair :: Parser s e (# (# #) | Char# #) -> ((# (# #) | Char# #) -> Parser s e (# Int#, Int# #)) -> Parser s e (# Int#, Int# #) bindFromMaybeCharToLifted :: Parser s e (# (# #) | Char# #) -> ((# (# #) | Char# #) -> Parser s e a) -> Parser s e a pureIntPair :: (# Int#, Int# #) -> Parser s e (# Int#, Int# #) failIntPair :: e -> Parser e s (# Int#, Int# #) -- | Little-endian fixed-width numbers. module Data.Bytes.Parser.LittleEndian -- | Unsigned 8-bit word. word8 :: e -> Parser e s Word8 -- | Unsigned 16-bit word. word16 :: e -> Parser e s Word16 -- | Unsigned 32-bit word. word32 :: e -> Parser e s Word32 -- | Unsigned 64-bit word. word64 :: e -> Parser e s Word64 -- | Unsigned 128-bit word. word128 :: e -> Parser e s Word128 -- | Signed 8-bit integer. int8 :: e -> Parser e s Int8 -- | Signed 16-bit integer. int16 :: e -> Parser e s Int16 -- | Signed 32-bit integer. int32 :: e -> Parser e s Int32 -- | Signed 64-bit integer. int64 :: e -> Parser e s Int64 -- | Array of little-endian unsigned 16-bit words. If the host is -- little-endian, the implementation is optimized to simply -- memcpy bytes into the result array. The result array always -- has elements in native-endian byte order. word16Array :: e -> Int -> Parser e s (PrimArray Word16) -- | Parse an array of little-endian unsigned 32-bit words. word32Array :: e -> Int -> Parser e s (PrimArray Word32) -- | Parse an array of little-endian unsigned 64-bit words. word64Array :: e -> Int -> Parser e s (PrimArray Word64) -- | Parse an array of little-endian unsigned 128-bit words. word128Array :: e -> Int -> Parser e s (PrimArray Word128) -- | Parse an array of little-endian signed 64-bit words. int64Array :: e -> Int -> Parser e s (PrimArray Int64) -- | Parse input as though it were text encoded by ISO 8859-1 (Latin-1). -- All byte sequences are valid text under ISO 8859-1. module Data.Bytes.Parser.Latin -- | Consume the next character, failing if it does not match the expected -- value or if there is no more input. char :: e -> Char -> Parser e s () -- | Consume the next two characters, failing if they do not match the -- expected values. -- --
-- char2 e a b === char e a *> char e b --char2 :: e -> Char -> Char -> Parser e s () -- | Consume three characters, failing if they do not match the expected -- values. -- --
-- char3 e a b c === char e a *> char e b *> char e c --char3 :: e -> Char -> Char -> Char -> Parser e s () -- | Consume four characters, failing if they do not match the expected -- values. -- --
-- char4 e a b c d === char e a *> char e b *> char e c *> char e d --char4 :: e -> Char -> Char -> Char -> Char -> Parser e s () -- | Consume five characters, failing if they do not match the expected -- values. char5 :: e -> Char -> Char -> Char -> Char -> Char -> Parser e s () -- | Consume six characters, failing if they do not match the expected -- values. char6 :: e -> Char -> Char -> Char -> Char -> Char -> Char -> Parser e s () -- | Consume seven characters, failing if they do not match the expected -- values. char7 :: e -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Parser e s () -- | Consume eight characters, failing if they do not match the expected -- values. char8 :: e -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Parser e s () -- | Consume nine characters, failing if they do not match the expected -- values. char9 :: e -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Parser e s () -- | Consume ten characters, failing if they do not match the expected -- values. char10 :: e -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Parser e s () -- | Consume ten characters, failing if they do not match the expected -- values. char11 :: e -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Char -> Parser e s () -- | Runs the predicate on the next character in the input. If the -- predicate is matched, this consumes the character. Otherwise, the -- character is not consumed. This returns False if the end of -- the input has been reached. This never fails. trySatisfy :: (Char -> Bool) -> Parser e s Bool -- | Runs the function on the next character in the input. If the function -- returns Just, this consumes the character and then runs the -- parser on the remaining input. If the function returns -- Nothing, this does not consume the tested character, and it -- runs the default parser on the input (which includes the tested -- character). If there is no input remaining, this also runs the default -- parser. This combinator never fails. trySatisfyThen :: forall (r :: RuntimeRep) (e :: Type) (s :: Type) (a :: TYPE r). Parser e s a -> (Char -> Maybe (Parser e s a)) -> Parser e s a -- | Consumes and returns the next character in the input. any :: e -> Parser e s Char -- | Consume a character from the input or return Nothing if end -- of the stream has been reached. Since ISO 8859-1 maps every bytes to a -- character, this parser never fails. opt :: Parser e s (Maybe Char) -- | Variant of opt with unboxed result. opt# :: Parser e s (# (# #) | Char# #) -- | Skip the characters 0-9 until a non-digit is encountered. -- This parser does not fail. skipDigits :: Parser e s () -- | Variant of skipDigits that requires at least one digit to be -- present. skipDigits1 :: e -> Parser e s () -- | Skip the character any number of times. This succeeds even if the -- character was not present. skipChar :: Char -> Parser e s () -- | Skip the character any number of times. It must occur at least once or -- else this will fail. skipChar1 :: e -> Char -> Parser e s () -- | Skip all characters until the terminator is encountered and then -- consume the matching character as well. Visually, skipTrailedBy -- 'C' advances the cursor like this: -- --
-- A Z B Y C X C W -- |->->->->-| ---- -- This fails if it reaches the end of input without encountering the -- character. skipTrailedBy :: e -> Char -> Parser e s () -- | Skip all characters until the terminator is encountered. This does not -- consume the terminator. Visually, skipUntil 'C' advances the -- cursor like this: -- --
-- A Z B Y C X C W -- |->->->-| ---- -- This succeeds if it reaches the end of the input without encountering -- the terminator. It never fails. skipUntil :: Char -> Parser e s () -- | Parse a decimal-encoded number. If the number is too large to be -- represented by a machine word, this fails with the provided error -- message. This accepts any number of leading zeroes. decWord :: e -> Parser e s Word -- | Parse a decimal-encoded 8-bit word. If the number is larger than 255, -- this parser fails. decWord8 :: e -> Parser e s Word8 -- | Parse a decimal-encoded 16-bit word. If the number is larger than -- 65535, this parser fails. decWord16 :: e -> Parser e s Word16 -- | Parse a decimal-encoded 32-bit word. If the number is larger than -- 4294967295, this parser fails. decWord32 :: e -> Parser e s Word32 -- | Parse a decimal-encoded unsigned number. If the number is too large to -- be represented by a 64-bit word, this fails with the provided error -- message. This accepts any number of leading zeroes. decWord64 :: e -> Parser e s Word64 -- | Parse a decimal-encoded number. If the number is too large to be -- represented by a machine integer, this fails with the provided error -- message. This rejects input with that is preceeded by plus or minus. -- Consequently, it does not parse negative numbers. Use -- decStandardInt or decSignedInt for that purpose. On a -- 64-bit platform decWord will successfully parse -- 9223372036854775808 (i.e. 2 ^ 63), but decUnsignedInt -- will fail. This parser allows leading zeroes. decUnsignedInt :: e -> Parser e s Int -- | Variant of decUnsignedInt with an unboxed result. decUnsignedInt# :: e -> Parser e s Int# -- | Parse a decimal-encoded number. If the number is too large to be -- represented by a machine integer, this fails with the provided error -- message. This allows the number to optionally be prefixed by plus or -- minus. If the sign prefix is not present, the number is interpreted as -- positive. This allows leading zeroes. decSignedInt :: e -> Parser e s Int -- | Parse a decimal-encoded number. If the number is too large to be -- represented by a machine integer, this fails with the provided error -- message. This allows the number to optionally be prefixed by minus. If -- the minus prefix is not present, the number is interpreted as -- positive. The disallows a leading plus sign. For example, -- decStandardInt rejects +42, but decSignedInt -- allows it. decStandardInt :: e -> Parser e s Int -- | Variant of decUnsignedInt that lets the caller supply a leading -- digit. This is useful when parsing formats like JSON where integers -- with leading zeroes are considered invalid. The calling context must -- consume the first digit before calling this parser. Results are always -- positive numbers. decTrailingInt :: e -> Int -> Parser e s Int decTrailingInt# :: e -> Int# -> Parser e s Int# -- | Parse a decimal-encoded integer of arbitrary size. This accepts input -- that begins with a plus or minus sign. Input without a sign prefix is -- interpreted as positive. decSignedInteger :: e -> Parser e s Integer -- | Parse a decimal-encoded positive integer of arbitrary size. This -- rejects input that begins with a plus or minus sign. decUnsignedInteger :: e -> Parser e s Integer -- | Variant of decUnsignedInteger that lets the caller supply a -- leading digit. This is useful when parsing formats like JSON where -- integers with leading zeroes are considered invalid. The calling -- context must consume the first digit before calling this parser. -- Results are always positive numbers. decTrailingInteger :: Int -> Parser e s Integer -- | Parse a hexadecimal-encoded 8-bit word. If the number is larger than -- 255, this parser fails. This allows leading zeroes and is insensitive -- to case. For example, 00A, 0a and A would -- all be accepted as the same number. hexWord8 :: e -> Parser e s Word8 -- | Parse a hexadecimal-encoded 16-bit word. If the number is larger than -- 65535, this parser fails. This allows leading zeroes and is -- insensitive to case. For example, 0100a and 100A -- would both be accepted as the same number. hexWord16 :: e -> Parser e s Word16 -- | Parse exactly two ASCII-encoded characters, interpretting them as the -- hexadecimal encoding of a 8-bit number. Note that this rejects a -- sequence such as A, requiring 0A instead. This is -- insensitive to case. hexFixedWord8 :: e -> Parser e s Word8 -- | Parse exactly four ASCII-encoded characters, interpretting them as the -- hexadecimal encoding of a 16-bit number. Note that this rejects a -- sequence such as 5A9, requiring 05A9 instead. This -- is insensitive to case. This is particularly useful when parsing -- escape sequences in C or JSON, which allow encoding characters in the -- Basic Multilingual Plane as \uhhhh. hexFixedWord16 :: e -> Parser e s Word16 hexFixedWord32 :: e -> Parser e s Word32 -- | Consume a single character that is the lowercase hexadecimal encoding -- of a 4-bit word. Fails if the character is not in the class -- [a-f0-9]. hexNibbleLower :: e -> Parser e s Word -- | Consume a single character that is the lowercase hexadecimal encoding -- of a 4-bit word. Returns Nothing without consuming the -- character if it is not in the class [a-f0-9]. The parser -- never fails. tryHexNibbleLower :: Parser e s (Maybe Word) -- | Consume a single character that is the case-insensitive hexadecimal -- encoding of a 4-bit word. Fails if the character is not in the class -- [a-fA-F0-9]. hexNibble :: e -> Parser e s Word -- | Consume a single character that is the case-insensitive hexadecimal -- encoding of a 4-bit word. Returns Nothing without consuming -- the character if it is not in the class [a-fA-F0-9]. This -- parser never fails. tryHexNibble :: Parser e s (Maybe Word) -- | Parse input as ASCII-encoded text. Some parsers in this module, like -- any and peek, fail if they encounter a byte above -- 0x7F. Others, like numeric parsers and skipping parsers, -- leave the cursor at the position of the offending byte without -- failing. module Data.Bytes.Parser.Ascii -- | Consume the next character, failing if it does not match the expected -- value or if there is no more input. char :: e -> Char -> Parser e s () -- | Consume the next two characters, failing if they do not match the -- expected values. -- --
-- char2 e a b === char e a *> char e b --char2 :: e -> Char -> Char -> Parser e s () -- | Consume three characters, failing if they do not match the expected -- values. -- --
-- char3 e a b c === char e a *> char e b *> char e c --char3 :: e -> Char -> Char -> Char -> Parser e s () -- | Consume four characters, failing if they do not match the expected -- values. -- --
-- char4 e a b c d === char e a *> char e b *> char e c *> char e d --char4 :: e -> Char -> Char -> Char -> Char -> Parser e s () -- | Consumes and returns the next character in the input. any :: e -> Parser e s Char -- | Variant of any with unboxed result. any# :: e -> Parser e s Char# -- | Examine the next byte without consuming it, interpret it as an -- ASCII-encoded character. This fails if the byte is above 0x7F -- or if the end of input has been reached. peek :: e -> Parser e s Char -- | Consume the next byte, interpreting it as an ASCII-encoded character. -- Fails if the byte is above 0x7F. Returns Nothing if -- the end of the input has been reached. opt :: e -> Parser e s (Maybe Char) -- | Consume input through the next occurrence of the target character and -- return the consumed input, excluding the target character, as a -- ShortText. This fails if it encounters any bytes above -- 0x7F. shortTrailedBy :: e -> Char -> Parser e s ShortText -- | Consume characters matching the predicate. The stops when it -- encounters a non-matching character or when it encounters a byte above -- 0x7F. This never fails. takeShortWhile :: (Char -> Bool) -> Parser e s ShortText -- | Skip the characters 0-9 until a non-digit is encountered. -- This parser does not fail. skipDigits :: Parser e s () -- | Variant of skipDigits that requires at least one digit to be -- present. skipDigits1 :: e -> Parser e s () -- | Skip the character any number of times. This succeeds even if the -- character was not present. skipChar :: Char -> Parser e s () -- | Skip the character any number of times. It must occur at least once or -- else this will fail. skipChar1 :: e -> Char -> Parser e s () -- | Skip uppercase and lowercase letters until a non-alpha character is -- encountered. skipAlpha :: Parser e s () -- | Skip uppercase and lowercase letters until a non-alpha character is -- encountered. skipAlpha1 :: e -> Parser e s () -- | Consume input until the trailer is found. Then, consume the trailer as -- well. This fails if the trailer is not found or if any non-ASCII -- characters are encountered. skipTrailedBy :: e -> Char -> Parser e s () -- | Consume characters matching the predicate. The stops when it -- encounters a non-matching character or when it encounters a byte above -- 0x7F. This never fails. skipWhile :: (Char -> Bool) -> Parser e s () -- | Parse a decimal-encoded number. If the number is too large to be -- represented by a machine word, this fails with the provided error -- message. This accepts any number of leading zeroes. decWord :: e -> Parser e s Word -- | Parse a decimal-encoded 8-bit word. If the number is larger than 255, -- this parser fails. decWord8 :: e -> Parser e s Word8 -- | Parse a decimal-encoded 16-bit word. If the number is larger than -- 65535, this parser fails. decWord16 :: e -> Parser e s Word16 -- | Parse a decimal-encoded 32-bit word. If the number is larger than -- 4294967295, this parser fails. decWord32 :: e -> Parser e s Word32 -- | Big-endian fixed-width numbers. module Data.Bytes.Parser.BigEndian -- | Unsigned 8-bit word. word8 :: e -> Parser e s Word8 -- | Unsigned 16-bit word. word16 :: e -> Parser e s Word16 -- | Unsigned 32-bit word. word32 :: e -> Parser e s Word32 -- | Unsigned 64-bit word. word64 :: e -> Parser e s Word64 -- | Unsigned 128-bit word. word128 :: e -> Parser e s Word128 -- | Signed 8-bit integer. int8 :: e -> Parser e s Int8 -- | Signed 16-bit integer. int16 :: e -> Parser e s Int16 -- | Signed 32-bit integer. int32 :: e -> Parser e s Int32 -- | Signed 64-bit integer. int64 :: e -> Parser e s Int64 -- | Parse an array of big-endian unsigned 16-bit words. If the host is -- big-endian, the implementation is optimized to simply memcpy -- bytes into the result array. The result array always has elements in -- native-endian byte order. word16Array :: e -> Int -> Parser e s (PrimArray Word16) -- | Parse an array of big-endian unsigned 32-bit words. word32Array :: e -> Int -> Parser e s (PrimArray Word32) -- | Parse an array of big-endian unsigned 64-bit words. word64Array :: e -> Int -> Parser e s (PrimArray Word64) -- | Parse an array of big-endian unsigned 128-bit words. word128Array :: e -> Int -> Parser e s (PrimArray Word128) -- | Parse input as UTF-8-encoded text. Parsers in this module will fail if -- they encounter a byte above 0x7F. module Data.Bytes.Parser.Utf8 -- | Interpret the next one to four bytes as a UTF-8-encoded character. -- Fails if the decoded codepoint is in the range U+D800 through U+DFFF. any# :: e -> Parser e s Char# -- | Consume input that matches the argument. Fails if the input does not -- match. shortText :: e -> ShortText -> Parser e s ()