Safe Haskell | None |
---|---|
Language | GHC2021 |
Symparsec.Parser.Natural
Synopsis
- data NatBase (base :: Natural) (parseDigit :: Char ~> Maybe Natural) (s :: FunKind PState (PReply Natural))
- data NatBase1 (base :: Natural) (parseDigit :: Char ~> Maybe Natural) (digit :: Natural) (s :: FunKind PState (PReply Natural))
- type NatDec = NatBase 10 ParseDigitDecSym
- type NatHex = NatBase 16 ParseDigitHexSym
- type NatBin = NatBase 2 ParseDigitBinSym
- type NatOct = NatBase 8 ParseDigitOctSym
- data NatBaseWhile (base :: Natural) (parseDigit :: Char ~> Maybe Natural) (s :: FunKind PState (PReply Natural))
Documentation
data NatBase (base :: Natural) (parseDigit :: Char ~> Maybe Natural) (s :: FunKind PState (PReply Natural)) Source #
data NatBase1 (base :: Natural) (parseDigit :: Char ~> Maybe Natural) (digit :: Natural) (s :: FunKind PState (PReply Natural)) Source #
Parse a Natural
with the given starting value.
Skips some extra work. May be handy for hand-written parsers.
type NatHex = NatBase 16 ParseDigitHexSym Source #
Parse a hexadecimal (base 16) Natural
. Permits mixed-case (0-9A-Fa-f
).
data NatBaseWhile (base :: Natural) (parseDigit :: Char ~> Maybe Natural) (s :: FunKind PState (PReply Natural)) Source #
Parse a non-empty Natural
using the given base and digit parser.
Only permits parsing numbers with digits exactly one Char
long.
Returns an error if it parses zero digits, or if the first digit fails to parse. Returns success on parsing up to EOF, or just before the first failed character parse. (Should match the behaviour of Megaparsec's number parsers.)