Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- type NatBin = NatBase 2 ParseDigitBinSym
- type NatOct = NatBase 8 ParseDigitOctSym
- type NatDec = NatBase 10 ParseDigitDecSym
- type NatHex = NatBase 16 ParseDigitHexSym
- type NatBase base parseDigit = 'PParser (NatBaseChSym base parseDigit) NatBaseEndSym Nothing
- sNatBase :: SNat base -> SParseDigit parseDigit -> SParser (SMaybe SNat) SNat (NatBase base parseDigit)
- type NatBaseCh base parseDigit ch mn = NatBaseCh' base mn (parseDigit @@ ch)
- type family NatBaseCh' base mn mDigit where ...
- type EInvalidDigit base = EBase "NatBase" ((Text "not a base " :<>: Text (ShowNatDec base)) :<>: Text " digit")
- eInvalidDigit :: SNat base -> SE (EInvalidDigit base)
- data NatBaseChSym base parseDigit f
- data NatBaseChSym1 base parseDigit ch mn
- sNatBaseChSym :: SNat base -> SParseDigit parseDigit -> SParserChSym (SMaybe SNat) SNat (NatBaseChSym base parseDigit)
- type family NatBaseEnd mn where ...
- type EEmpty = EBase "NatBase" (Text "no digits parsed")
- eEmpty :: SE EEmpty
- data NatBaseEndSym mn
- sNatBaseEndSym :: SParserEndSym (SMaybe SNat) SNat NatBaseEndSym
Documentation
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 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 NatBase base parseDigit = 'PParser (NatBaseChSym base parseDigit) NatBaseEndSym Nothing Source #
Parse a natural in the given base, using the given digit parser.
sNatBase :: SNat base -> SParseDigit parseDigit -> SParser (SMaybe SNat) SNat (NatBase base parseDigit) Source #
type NatBaseCh base parseDigit ch mn = NatBaseCh' base mn (parseDigit @@ ch) Source #
type family NatBaseCh' base mn mDigit where ... Source #
NatBaseCh' base (Just n) (Just digit) = Cont (Just ((n * base) + digit)) | |
NatBaseCh' base Nothing (Just digit) = Cont (Just digit) | |
NatBaseCh' base mn Nothing = Err (EInvalidDigit base) |
type EInvalidDigit base = EBase "NatBase" ((Text "not a base " :<>: Text (ShowNatDec base)) :<>: Text " digit") Source #
eInvalidDigit :: SNat base -> SE (EInvalidDigit base) Source #
data NatBaseChSym base parseDigit f Source #
Instances
(KnownNat base, SingParseDigit parseDigit) => SingParser (NatBase base parseDigit :: PParser (Maybe Natural) Natural) Source # | |
type PS (NatBase base parseDigit :: PParser (Maybe Natural) Natural) Source # | |
type App (NatBaseChSym base parseDigit :: FunKind Char (Maybe Natural ~> PResult (Maybe Natural) Natural) -> Type) (f :: Char) Source # | |
Defined in Symparsec.Parser.Natural | |
type PR (NatBase base parseDigit :: PParser (Maybe Natural) Natural) Source # | |
data NatBaseChSym1 base parseDigit ch mn Source #
sNatBaseChSym :: SNat base -> SParseDigit parseDigit -> SParserChSym (SMaybe SNat) SNat (NatBaseChSym base parseDigit) Source #
type family NatBaseEnd mn where ... Source #
NatBaseEnd (Just n) = Right n | |
NatBaseEnd Nothing = Left EEmpty |
data NatBaseEndSym mn Source #
Instances
(KnownNat base, SingParseDigit parseDigit) => SingParser (NatBase base parseDigit :: PParser (Maybe Natural) Natural) Source # | |
type PS (NatBase base parseDigit :: PParser (Maybe Natural) Natural) Source # | |
type PR (NatBase base parseDigit :: PParser (Maybe Natural) Natural) Source # | |
type App NatBaseEndSym (mn :: Maybe Natural) Source # | |
Defined in Symparsec.Parser.Natural |