-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Type level string parser combinators -- -- Please see README.md. @package symbol-parser @version 0.2.0 -- | Parse digits from type-level Chars. -- -- A Nothing indicates the given Char was not a valid digit -- for the given base. module Data.Type.Char.Digits -- | Parse a binary digit (0 or 1). type family ParseBinaryDigit (ch :: Char) :: Maybe Natural -- | Parse an octal digit (0-7). type family ParseOctalDigit (ch :: Char) :: Maybe Natural -- | Parse a decimal digit (0-9). type family ParseDecimalDigit (ch :: Char) :: Maybe Natural -- | Parse a hexadecimal digit (0-9A-Fa-f). -- -- Both upper and lower case are permitted. type family ParseHexDigit (ch :: Char) :: Maybe Natural module Data.Type.Symbol.Parser.Internal type ParserCh s r = Char -> s -> Result s r type ParserEnd s r = s -> Either ErrorMessage r data Result s r Cont :: s -> Result s r Done :: r -> Result s r Err :: ErrorMessage -> Result s r type ParserChSym s r = Char ~> s ~> Result s r type ParserEndSym s r = s ~> Either ErrorMessage r type Parser s r = (ParserChSym s r, ParserEndSym s r, s) type family RunParser p sym type family RunParser' pCh pEnd idx s msym type family RunParserEnd idx end type family RunParser'' pCh pEnd idx ch res sym module Data.Type.Symbol.Parser.End type End = '(EndChSym, EndEndSym, '()) module Data.Type.Symbol.Parser.Drop type Drop n = '(DropChSym, DropEndSym, n) module Data.Type.Symbol.Parser.Isolate type family Isolate n p type family IsolateCh pCh pEnd ch s type family IsolateInnerEnd' pEnd res type family IsolateInnerEnd a type family IsolateInner n a type family IsolateEnd s data IsolateChSym pCh pEnd f data IsolateChSym1 pCh pEnd ch s data IsolateEndSym s module Data.Type.Symbol.Parser.Literal type Literal sym = '(LiteralChSym, LiteralEndSym, UnconsSymbol sym) module Data.Type.Symbol.Parser.Natural type NatBin = NatBase 2 ParseBinaryDigitSym type NatOct = NatBase 8 ParseOctalDigitSym type NatDec = NatBase 10 ParseDecimalDigitSym type NatHex = NatBase 16 ParseHexDigitSym type NatBase base parseDigit = '(NatBaseChSym base parseDigit, NatBaseEndSym, 0) type family NatBaseCh base parseDigit ch n type family NatBaseCh' base n mDigit type NatBaseEnd n = Right n data NatBaseChSym base parseDigit f data NatBaseChSym1 base parseDigit ch n data NatBaseEndSym n data ParseBinaryDigitSym a data ParseOctalDigitSym a data ParseDecimalDigitSym a data ParseHexDigitSym a module Data.Type.Symbol.Parser.Then type family Then pl pr type family ThenCh plCh prCh sr ch s type family ThenL sr resl type family ThenR rl resr type family ThenEnd prEnd s type family ThenEnd' rl s data ThenChSym plCh prCh sr f data ThenChSym1 plCh prCh sr ch s data ThenEndSym prEnd s module Data.Type.Symbol.Parser.Then.VoidLeft type family ThenVL pl pr type family ThenVLCh plCh prCh sr ch s type family ThenVLL sr resl type family ThenVLR resr type family ThenVLEnd prEnd s type family ThenVLEnd' s data ThenVLChSym plCh prCh sr f data ThenVLChSym1 plCh prCh sr ch s data ThenVLEndSym prEnd s module Data.Type.Symbol.Parser.Then.VoidRight type family ThenVR pl pr type family ThenVRCh plCh prCh sr ch s type family ThenVRL sr resl type family ThenVRR rl resr type family ThenVREnd prEnd s type family ThenVREnd' rl s data ThenVRChSym plCh prCh sr f data ThenVRChSym1 plCh prCh sr ch s data ThenVREndSym prEnd s module Data.Type.Symbol.Parser type Parser s r = (ParserChSym s r, ParserEndSym s r, s) type family RunParser p sym type family Isolate n p -- | Sequence parsers, returning both values in a tuple. type pl :<*>: pr = Then pl pr -- | Sequence parsers, discarding the return value of the left parser type pl :*>: pr = ThenVL pl pr -- | Sequence parsers, discarding the return value of the right parser. -- -- Consider using :*>: instead, which is simpler and -- potentially faster since we parse L->R. type pl :<*: pr = ThenVR pl pr type Drop n = '(DropChSym, DropEndSym, n) type Literal sym = '(LiteralChSym, LiteralEndSym, UnconsSymbol sym) type End = '(EndChSym, EndEndSym, '()) type NatDec = NatBase 10 ParseDecimalDigitSym type NatHex = NatBase 16 ParseHexDigitSym type NatBin = NatBase 2 ParseBinaryDigitSym type NatOct = NatBase 8 ParseOctalDigitSym type NatBase base parseDigit = '(NatBaseChSym base parseDigit, NatBaseEndSym, 0)