| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Symparsec.Parsers
Description
Type-level string parsers.
You may ignore the equations that Haddock displays: they are internal and irrelevant to library usage.
Synopsis
- type family pl :<*>: pr where ...
- type family pl :*>: pr where ...
- type family pl :<*: pr where ...
- type Take n = 'PParser TakeChSym TakeEndSym '(n, '[])
- type Skip n = 'PParser SkipChSym SkipEndSym n
- type End = 'PParser (FailChSym "End" (Text "expected end of string")) (Con1 Right) '()
- type family Isolate n p where ...
- type Literal str = 'PParser LiteralChSym LiteralEndSym str
- type NatDec = NatBase 10 ParseDigitDecSym
- type NatHex = NatBase 16 ParseDigitHexSym
- type NatBin = NatBase 2 ParseDigitBinSym
- type NatOct = NatBase 8 ParseDigitOctSym
- type NatBase base parseDigit = 'PParser (NatBaseChSym base parseDigit) NatBaseEndSym Nothing
Binary combinators
Parsers that combine two parsers. Any parsers that have term-level parallels
will use the same fixity e.g. :<*>: is infixl 4, same as <*>.
type family pl :<*>: pr where ... infixl 4 Source #
Sequence two parsers, running left then right, and return both results.
type family pl :*>: pr where ... infixl 4 Source #
Sequence two parsers, running left then right, and discard the return value of the left parser.
type family pl :<*: pr where ... infixl 4 Source #
Sequence two parsers, running left then right, and discard the return value of the right parser.
Positional
Parsers that relate to symbol position e.g. length, end of symbol.
type Skip n = 'PParser SkipChSym SkipEndSym n Source #
Skip forward n characters. Fails if fewer than n characters are
available'.
type End = 'PParser (FailChSym "End" (Text "expected end of string")) (Con1 Right) '() Source #
Assert end of symbol, or fail.
type family Isolate n p where ... Source #
Run the given parser isolated to the next n characters.
All isolated characters must be consumed.
Basic
Simple non-combinator parsers. Probably fundamental in some way e.g. very general or common.
type Literal str = 'PParser LiteralChSym LiteralEndSym str Source #
Parse the given Symbol.
Naturals
type NatDec = NatBase 10 ParseDigitDecSym Source #
Parse a decimal (base 10) natural.
type NatHex = NatBase 16 ParseDigitHexSym Source #
Parse a hexadecimal (base 16) natural. Permits mixed-case (0-9A-Fa-f).
type NatBin = NatBase 2 ParseDigitBinSym Source #
Parse a binary (base 2) natural.
type NatOct = NatBase 8 ParseDigitOctSym Source #
Parse an octal (base 8) natural.
type NatBase base parseDigit = 'PParser (NatBaseChSym base parseDigit) NatBaseEndSym Nothing Source #
Parse a natural in the given base, using the given digit parser.