-- 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.3.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.List -- | Reverse a type level list. type Reverse as = Reverse' as '[] type family Reverse' (as :: [k]) (acc :: [k]) :: [k] -- | Data types and type synonyms for parsers and their defun symbols. module Data.Type.Symbol.Parser.Types -- | Parse a Char with the given state. -- -- The action is always consuming. For this reason, you may need to look -- ahead for the final case, so as to not consume an extra Char. -- This prevents many zero-length parsers. It's a bit weird. See -- Drop for an example. type ParserCh s r = Char -> s -> Result s r -- | The result of a single step of a parser. data Result s r -- | OK, continue with the given state Cont :: s -> Result s r -- | OK, parse successful with result r Done :: r -> Result s r -- | parse error Err :: E -> Result s r -- | What a parser should do at the end of a Symbol. type ParserEnd s r = s -> Either E r -- | Parser error. data E -- | Base parser error. EBase :: Symbol -> ErrorMessage -> E -- | Inner parser error inside combinator. EIn :: Symbol -> E -> E -- | A parser you can pass (heh) around. -- -- Parsers are defined by the product of a ParserCh character -- parser, ParserEnd end handler, and s starting state. type Parser s r = (ParserChSym s r, ParserEndSym s r, s) -- | A defunctionalization symbol for a ParserCh. type ParserChSym s r = Char ~> s ~> Result s r -- | A defunctionalization symbol for a ParserEnd. type ParserEndSym s r = s ~> Either E r module Data.Type.Symbol.Parser.Run -- | Run the given parser on the given Symbol. type family Run p sym module Data.Type.Symbol.Parser.Parser.Then.VoidRight type family ThenVR pl pr module Data.Type.Symbol.Parser.Parser.Then.VoidLeft type family ThenVL pl pr module Data.Type.Symbol.Parser.Parser.Then type family Then pl pr -- | Choice operator. Try left; if it fails, try right. -- -- This is a problematic combinator: -- --