symparsec-1.0.0: Type level string parser combinators
Safe HaskellSafe-Inferred
LanguageGHC2021

Symparsec.Parsers

Description

Type-level string parsers.

You may ignore the equations that Haddock displays: they are internal and irrelevant to library usage.

Synopsis

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.

Equations

('PParser plCh plEnd s0l) :<*>: ('PParser prCh prEnd s0r) = Then' plCh plEnd s0l prCh prEnd s0r 

type family pl :*>: pr where ... infixl 4 Source #

Sequence two parsers, running left then right, and discard the return value of the left parser.

Equations

('PParser plCh plEnd s0l) :*>: ('PParser prCh prEnd s0r) = ThenVL' plCh plEnd s0l prCh prEnd s0r 

type family pl :<*: pr where ... infixl 4 Source #

Sequence two parsers, running left then right, and discard the return value of the right parser.

Equations

('PParser plCh plEnd s0l) :<*: ('PParser prCh prEnd s0r) = ThenVR' plCh plEnd s0l prCh prEnd s0r 

Positional

Parsers that relate to symbol position e.g. length, end of symbol.

type Take n = 'PParser TakeChSym TakeEndSym '(n, '[]) Source #

Return the next n characters.

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.

Equations

Isolate n ('PParser pCh pEnd s0) = Isolate' n pCh pEnd s0 

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.