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

Modulebytesmith-0.3.11.1Haskell2010

Data.Bytes.Parser.Ascii

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.

  • 23 values

Matching

4 declarations
valuechar :: e -> Char -> Parser e s ()
#

Consume the next character, failing if it does not match the expected value or if there is no more input.

valuechar2 :: e -> Char -> 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
valuechar3 :: e -> Char -> 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
valuechar4 :: e -> Char -> 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

Case-Insensitive Matching

1 declaration
valuecharInsensitive :: e -> Char -> Parser e s ()
#

Consume the next character, failing if it does not match the expected value or if there is no more input. This check for equality is case insensitive.

Precondition: The argument must be a letter ([a-zA-Z]). Behavior is undefined if it is not.

Get Character

4 declarations
valueany :: e -> Parser e s Char
#

Consumes and returns the next character in the input.

valuepeek :: 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.

valueopt :: e -> Parser e s (Maybe 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.

Match Many

2 declarations
valueshortTrailedBy :: e -> Char -> Parser e s ShortText
#

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.

valuetakeShortWhile :: (Char -> Bool) -> 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.

Skip

8 declarations
valueskipDigits :: Parser e s ()
#

Skip the characters 0-9 until a non-digit is encountered. This parser does not fail.

valueskipChar :: Char -> Parser e s ()
#

Skip the character any number of times. This succeeds even if the character was not present.

valueskipChar1 :: e -> Char -> Parser e s ()
#

Skip the character any number of times. It must occur at least once or else this will fail.

valueskipAlpha :: Parser e s ()
#

Skip uppercase and lowercase letters until a non-alpha character is encountered.

valueskipAlpha1 :: e -> Parser e s ()
#

Skip uppercase and lowercase letters until a non-alpha character is encountered.

valueskipTrailedBy :: e -> Char -> 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.

valueskipWhile :: (Char -> Bool) -> 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.

Numbers

4 declarations
valuedecWord :: e -> Parser e s Word
#

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.

valuedecWord8 :: e -> Parser e s Word8
#

Parse a decimal-encoded 8-bit word. If the number is larger than 255, this parser fails.

valuedecWord16 :: e -> Parser e s Word16
#

Parse a decimal-encoded 16-bit word. If the number is larger than 65535, this parser fails.

valuedecWord32 :: e -> Parser e s Word32
#

Parse a decimal-encoded 32-bit word. If the number is larger than 4294967295, this parser fails.