Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Parsers for integral numbers written in positional numeral systems.
Synopsis
- class PositionalSystem s where
- systemName :: s -> String
- radixIn :: Num α => s -> α
- isDigitIn :: s -> Char -> Bool
- isNzDigitIn :: s -> Char -> Bool
- fromDigitIn :: Num α => s -> Char -> Maybe α
- fromNzDigitIn :: Num α => s -> Char -> Maybe α
- unsafeFromDigitIn :: Num α => s -> Char -> α
- intToDigitIn :: s -> Int -> Char
- printDigitIn :: Printer p => s -> Char -> p
- printZeroIn :: Printer p => s -> p
- class PositionalSystem s => BitSystem s where
- digitBitsIn :: s -> Int
- digitMaskIn :: Num α => s -> α
- lastDigitIn :: Bits α => s -> α -> Int
- data Binary = Binary
- data Octal = Octal
- data Decimal = Decimal
- data Hexadecimal = Hexadecimal
- data LowHex = LowHex
- data UpHex = UpHex
- digitIn :: (PositionalSystem s, Num α, CharParsing μ) => s -> μ α
- nzDigitIn :: (PositionalSystem s, Num α, CharParsing μ) => s -> μ α
- binDigit :: (Num α, CharParsing μ) => μ α
- nzBinDigit :: (Num α, CharParsing μ) => μ α
- octDigit :: (Num α, CharParsing μ) => μ α
- nzOctDigit :: (Num α, CharParsing μ) => μ α
- decDigit :: (Num α, CharParsing μ) => μ α
- nzDecDigit :: (Num α, CharParsing μ) => μ α
- hexDigit :: (Num α, CharParsing μ) => μ α
- nzHexDigit :: (Num α, CharParsing μ) => μ α
- lowHexDigit :: (Num α, CharParsing μ) => μ α
- nzLowHexDigit :: (Num α, CharParsing μ) => μ α
- upHexDigit :: (Num α, CharParsing μ) => μ α
- nzUpHexDigit :: (Num α, CharParsing μ) => μ α
- nonNegative :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> μ α
- nnCompact :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> μ α
- nnUpTo :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> Int -> μ α
- nncUpTo :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> Int -> μ α
- nnBounded :: (PositionalSystem s, Ord α, Bounded α, Integral α, Monad μ, CharParsing μ) => s -> μ α
- nncBounded :: (PositionalSystem s, Ord α, Bounded α, Integral α, Monad μ, CharParsing μ) => s -> μ α
- nnBits :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α
- nncBits :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α
- nnBitsUpTo :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> Int -> μ α
- nncBitsUpTo :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> Int -> μ α
- nnbBits :: (BitSystem s, Ord α, Bounded α, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α
- nncbBits :: (BitSystem s, Ord α, Bounded α, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α
- nonPositive :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> μ α
- npCompact :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> μ α
- npUpTo :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> Int -> μ α
- npcUpTo :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> Int -> μ α
- npBounded :: (PositionalSystem s, Ord α, Bounded α, Integral α, Monad μ, CharParsing μ) => s -> μ α
- npcBounded :: (PositionalSystem s, Ord α, Bounded α, Integral α, Monad μ, CharParsing μ) => s -> μ α
- npBits :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α
- npcBits :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α
- npBitsUpTo :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> Int -> μ α
- npcBitsUpTo :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> Int -> μ α
- npbBits :: forall s μ α. (BitSystem s, Ord α, Bounded α, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α
- npcbBits :: forall s μ α. (BitSystem s, Ord α, Bounded α, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α
- data Sign
- applySign :: Num α => Sign -> α -> α
- optMinus :: CharParsing μ => μ Sign
- optSign :: CharParsing μ => μ Sign
- number' :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => μ Sign -> s -> μ α
- number :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> μ α
- compact' :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => μ Sign -> s -> μ α
- compact :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> μ α
- numberUpTo' :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => μ Sign -> s -> Int -> μ α
- numberUpTo :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> Int -> μ α
- compactUpTo' :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => μ Sign -> s -> Int -> μ α
- compactUpTo :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> Int -> μ α
- bounded' :: (PositionalSystem s, Ord α, Bounded α, Integral α, Monad μ, CharParsing μ) => μ Sign -> s -> μ α
- bounded :: (PositionalSystem s, Ord α, Bounded α, Integral α, Monad μ, CharParsing μ) => s -> μ α
- cBounded' :: (PositionalSystem s, Ord α, Bounded α, Integral α, Monad μ, CharParsing μ) => μ Sign -> s -> μ α
- cBounded :: (PositionalSystem s, Ord α, Bounded α, Integral α, Monad μ, CharParsing μ) => s -> μ α
- bits' :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => μ Sign -> s -> μ α
- bits :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α
- cBits' :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => μ Sign -> s -> μ α
- cBits :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α
- bitsUpTo' :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => μ Sign -> s -> Int -> μ α
- bitsUpTo :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> Int -> μ α
- cBitsUpTo' :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => μ Sign -> s -> Int -> μ α
- cBitsUpTo :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> Int -> μ α
- bBits' :: (BitSystem s, Ord α, Bounded α, Num α, Bits α, Monad μ, CharParsing μ) => μ Sign -> s -> μ α
- bBits :: (BitSystem s, Ord α, Bounded α, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α
- cbBits' :: (BitSystem s, Ord α, Bounded α, Num α, Bits α, Monad μ, CharParsing μ) => μ Sign -> s -> μ α
- cbBits :: (BitSystem s, Ord α, Bounded α, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α
Positional numeral systems
class PositionalSystem s where Source #
Positional numeral system.
systemName, radixIn, isDigitIn, isNzDigitIn, fromDigitIn, fromNzDigitIn, unsafeFromDigitIn, intToDigitIn
systemName :: s -> String Source #
The name of the system (e.g. "binary", "decimal").
radixIn :: Num α => s -> α Source #
The radix of the system.
isDigitIn :: s -> Char -> Bool Source #
Test if a character is a digit.
isNzDigitIn :: s -> Char -> Bool Source #
Test if a character is a non-zero digit.
fromDigitIn :: Num α => s -> Char -> Maybe α Source #
Map digits to the corresponding numbers. Return Nothing
on
other inputs.
fromNzDigitIn :: Num α => s -> Char -> Maybe α Source #
Map non-zero digits to the corresponding numbers. Return Nothing
on
other inputs.
unsafeFromDigitIn :: Num α => s -> Char -> α Source #
Map digits to the corresponding numbers. No checks are performed.
intToDigitIn :: s -> Int -> Char Source #
Map Int
values to the corresponding digits. Inputs must be
non-negative and less than the radix.
printDigitIn :: Printer p => s -> Char -> p Source #
Print a digit.
printZeroIn :: Printer p => s -> p Source #
Instances
class PositionalSystem s => BitSystem s where Source #
Positonal numeral system with a power of two radix.
digitBitsIn :: s -> Int Source #
Numer of bits occupied by a digit.
digitMaskIn :: Num α => s -> α Source #
The number that has digitBitsIn
least significant bits set to ones
and all the other bits set to zeroes.
lastDigitIn :: Bits α => s -> α -> Int Source #
Map the last digit of a number to the corresponding Int
value.
Instances
BitSystem Binary | |
Defined in Text.Printer.Integral | |
BitSystem Hexadecimal | |
Defined in Text.Printer.Integral digitBitsIn :: Hexadecimal -> Int Source # digitMaskIn :: Num α => Hexadecimal -> α Source # lastDigitIn :: Bits α => Hexadecimal -> α -> Int Source # | |
BitSystem LowHex | |
Defined in Text.Printer.Integral | |
BitSystem Octal | |
Defined in Text.Printer.Integral | |
BitSystem UpHex | |
Defined in Text.Printer.Integral |
The binary numeral system.
Instances
Generic Binary | |
Read Binary | |
Show Binary | |
Eq Binary | |
Ord Binary | |
BitSystem Binary | |
Defined in Text.Printer.Integral | |
PositionalSystem Binary | |
Defined in Text.Printer.Integral systemName :: Binary -> String Source # radixIn :: Num α => Binary -> α Source # isDigitIn :: Binary -> Char -> Bool Source # isNzDigitIn :: Binary -> Char -> Bool Source # fromDigitIn :: Num α => Binary -> Char -> Maybe α Source # fromNzDigitIn :: Num α => Binary -> Char -> Maybe α Source # unsafeFromDigitIn :: Num α => Binary -> Char -> α Source # intToDigitIn :: Binary -> Int -> Char Source # printDigitIn :: Printer p => Binary -> Char -> p Source # printZeroIn :: Printer p => Binary -> p Source # | |
type Rep Binary | |
The octal numeral system.
Instances
Generic Octal | |
Read Octal | |
Show Octal | |
Eq Octal | |
Ord Octal | |
BitSystem Octal | |
Defined in Text.Printer.Integral | |
PositionalSystem Octal | |
Defined in Text.Printer.Integral systemName :: Octal -> String Source # radixIn :: Num α => Octal -> α Source # isDigitIn :: Octal -> Char -> Bool Source # isNzDigitIn :: Octal -> Char -> Bool Source # fromDigitIn :: Num α => Octal -> Char -> Maybe α Source # fromNzDigitIn :: Num α => Octal -> Char -> Maybe α Source # unsafeFromDigitIn :: Num α => Octal -> Char -> α Source # intToDigitIn :: Octal -> Int -> Char Source # printDigitIn :: Printer p => Octal -> Char -> p Source # printZeroIn :: Printer p => Octal -> p Source # | |
type Rep Octal | |
The decimal numeral system.
Instances
Generic Decimal | |
Read Decimal | |
Show Decimal | |
Eq Decimal | |
Ord Decimal | |
PositionalSystem Decimal | |
Defined in Text.Printer.Integral systemName :: Decimal -> String Source # radixIn :: Num α => Decimal -> α Source # isDigitIn :: Decimal -> Char -> Bool Source # isNzDigitIn :: Decimal -> Char -> Bool Source # fromDigitIn :: Num α => Decimal -> Char -> Maybe α Source # fromNzDigitIn :: Num α => Decimal -> Char -> Maybe α Source # unsafeFromDigitIn :: Num α => Decimal -> Char -> α Source # intToDigitIn :: Decimal -> Int -> Char Source # printDigitIn :: Printer p => Decimal -> Char -> p Source # printZeroIn :: Printer p => Decimal -> p Source # | |
type Rep Decimal | |
data Hexadecimal Source #
The hexadecimal numeral system.
Instances
The hexadecimal numeral system, using lower case digits.
Instances
Generic LowHex | |
Read LowHex | |
Show LowHex | |
Eq LowHex | |
Ord LowHex | |
BitSystem LowHex | |
Defined in Text.Printer.Integral | |
PositionalSystem LowHex | |
Defined in Text.Printer.Integral systemName :: LowHex -> String Source # radixIn :: Num α => LowHex -> α Source # isDigitIn :: LowHex -> Char -> Bool Source # isNzDigitIn :: LowHex -> Char -> Bool Source # fromDigitIn :: Num α => LowHex -> Char -> Maybe α Source # fromNzDigitIn :: Num α => LowHex -> Char -> Maybe α Source # unsafeFromDigitIn :: Num α => LowHex -> Char -> α Source # intToDigitIn :: LowHex -> Int -> Char Source # printDigitIn :: Printer p => LowHex -> Char -> p Source # printZeroIn :: Printer p => LowHex -> p Source # | |
type Rep LowHex | |
The hexadecimal numeral system, using upper case digits.
Instances
Generic UpHex | |
Read UpHex | |
Show UpHex | |
Eq UpHex | |
Ord UpHex | |
BitSystem UpHex | |
Defined in Text.Printer.Integral | |
PositionalSystem UpHex | |
Defined in Text.Printer.Integral systemName :: UpHex -> String Source # radixIn :: Num α => UpHex -> α Source # isDigitIn :: UpHex -> Char -> Bool Source # isNzDigitIn :: UpHex -> Char -> Bool Source # fromDigitIn :: Num α => UpHex -> Char -> Maybe α Source # fromNzDigitIn :: Num α => UpHex -> Char -> Maybe α Source # unsafeFromDigitIn :: Num α => UpHex -> Char -> α Source # intToDigitIn :: UpHex -> Int -> Char Source # printDigitIn :: Printer p => UpHex -> Char -> p Source # printZeroIn :: Printer p => UpHex -> p Source # | |
type Rep UpHex | |
Single digits
digitIn :: (PositionalSystem s, Num α, CharParsing μ) => s -> μ α Source #
Parse a digit of the specified positional numeral system.
nzDigitIn :: (PositionalSystem s, Num α, CharParsing μ) => s -> μ α Source #
Parse a non-zero digit of the specified positional numeral system.
binDigit :: (Num α, CharParsing μ) => μ α Source #
Parse a binary digit.
nzBinDigit :: (Num α, CharParsing μ) => μ α Source #
Parse a non-zero binary digit ('1').
octDigit :: (Num α, CharParsing μ) => μ α Source #
Parse an octal digit.
nzOctDigit :: (Num α, CharParsing μ) => μ α Source #
Parse a non-zero octal digit.
decDigit :: (Num α, CharParsing μ) => μ α Source #
Parse a decimal digit.
nzDecDigit :: (Num α, CharParsing μ) => μ α Source #
Parse a non-zero decimal digit.
hexDigit :: (Num α, CharParsing μ) => μ α Source #
Parse a hexadecimal digit.
nzHexDigit :: (Num α, CharParsing μ) => μ α Source #
Parse a non-zero hexadecimal digit.
lowHexDigit :: (Num α, CharParsing μ) => μ α Source #
Parse a lower case hexadecimal digit.
nzLowHexDigit :: (Num α, CharParsing μ) => μ α Source #
Parse a non-zero lower case hexadecimal digit.
upHexDigit :: (Num α, CharParsing μ) => μ α Source #
Parse an upper case hexadecimal digit.
nzUpHexDigit :: (Num α, CharParsing μ) => μ α Source #
Parse a non-zero upper case hexadecimal digit.
Numbers
nonNegative :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> μ α Source #
Parse a non-negative number written in the specified positional numeral system.
nnCompact :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> μ α Source #
Parse a non-negative number written in the specified positional numeral system. Leading zeroes are not allowed.
nnUpTo :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> Int -> μ α Source #
Parse a non-negative number written in the specified positional numeral system (up to n digits).
nncUpTo :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> Int -> μ α Source #
Parse a non-negative number written in the specified positional numeral system (up to n digits). Leading zeroes are not allowed.
nnBounded :: (PositionalSystem s, Ord α, Bounded α, Integral α, Monad μ, CharParsing μ) => s -> μ α Source #
Parse a non-negative number written in the specified positional numeral system, failing on overflow.
nncBounded :: (PositionalSystem s, Ord α, Bounded α, Integral α, Monad μ, CharParsing μ) => s -> μ α Source #
Parse a non-negative number written in the specified positional numeral system, failing on overflow. Leading zeroes are not allowed.
nnBits :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α Source #
Parse a non-negative binary number written in the specified positional numeral system.
nncBits :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α Source #
Parse a non-negative binary number written in the specified positional numeral system. Leading zeroes are not allowed.
nnBitsUpTo :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> Int -> μ α Source #
Parse a non-negative binary number written in the specified positional numeral system (up to n digits).
nncBitsUpTo :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> Int -> μ α Source #
Parse a non-negative binary number written in the specified positional numeral system (up to n digits). Leading zeroes are not allowed.
nnbBits :: (BitSystem s, Ord α, Bounded α, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α Source #
Parse a non-negative binary number written in the specified positional numeral system, failing on overflow.
nncbBits :: (BitSystem s, Ord α, Bounded α, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α Source #
Parse a non-negative binary number written in the specified positional numeral system, failing on overflow. Leading zeroes are not allowed.
nonPositive :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> μ α Source #
Parse a non-positive number written in the specified positional numeral system. For example, parsing "123" as a decimal would produce -123, not 123.
npCompact :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> μ α Source #
Parse a non-positive number written in the specified positional numeral system. Leading zeroes are not allowed.
npUpTo :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> Int -> μ α Source #
Parse a non-positive number written in the specified positional numeral system (up to n digits).
npcUpTo :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> Int -> μ α Source #
Parse a non-positive number written in the specified positional numeral system (up to n digits). Leading zeroes are not allowed.
npBounded :: (PositionalSystem s, Ord α, Bounded α, Integral α, Monad μ, CharParsing μ) => s -> μ α Source #
Parse a non-positive number written in the specified positional numeral system, failing on overflow.
npcBounded :: (PositionalSystem s, Ord α, Bounded α, Integral α, Monad μ, CharParsing μ) => s -> μ α Source #
Parse a non-positive number written in the specified positional numeral system, failing on overflow. Leading zeroes are not allowed.
npBits :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α Source #
Parse a non-positive two's complement binary number written in the specified positional numeral system.
npcBits :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α Source #
Parse a non-positive two's complement binary number written in the specified positional numeral system. Leading zeroes are not allowed.
npBitsUpTo :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> Int -> μ α Source #
Parse a non-positive two's complement binary number written in the specified positional numeral system (up to n digits).
npcBitsUpTo :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> Int -> μ α Source #
Parse a non-positive two's complement binary number written in the specified positional numeral system (up to n digits). Leading zeroes are not allowed.
npbBits :: forall s μ α. (BitSystem s, Ord α, Bounded α, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α Source #
Parse a non-positive two's complement binary number written in the specified positional numeral system, failing on overflow.
npcbBits :: forall s μ α. (BitSystem s, Ord α, Bounded α, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α Source #
Parse a non-positive two's complement binary number written in the specified positional numeral system, failing on overflow. Leading zeroes are not allowed.
applySign :: Num α => Sign -> α -> α Source #
Negate the supplied value if the sign is NonPositive
and return it
as it is otherwise.
optMinus :: CharParsing μ => μ Sign Source #
Optional minus sign.
optSign :: CharParsing μ => μ Sign Source #
Optional minus or plus sign.
number' :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => μ Sign -> s -> μ α Source #
Parse a number written in the specified positional numeral system. The supplied parser is used to determine the sign of the number.
number :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> μ α Source #
compact' :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => μ Sign -> s -> μ α Source #
Parse a number written in the specified positional numeral system. The supplied parser is used to determine the sign of the number. Leading zeroes are not allowed.
compact :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> μ α Source #
numberUpTo' :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => μ Sign -> s -> Int -> μ α Source #
Parse a number written in the specified positional numeral system (up to n digits). The supplied parser is used to determine the sign of the number.
numberUpTo :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> Int -> μ α Source #
A shorthand for numberUpTo'
optMinus
.
compactUpTo' :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => μ Sign -> s -> Int -> μ α Source #
Parse a number written in the specified positional numeral system (up to n digits). The supplied parser is used to determine the sign of the number. Leading zeroes are not allowed.
compactUpTo :: (PositionalSystem s, Num α, Monad μ, CharParsing μ) => s -> Int -> μ α Source #
A shorthand for compactUpTo'
optMinus
.
bounded' :: (PositionalSystem s, Ord α, Bounded α, Integral α, Monad μ, CharParsing μ) => μ Sign -> s -> μ α Source #
Parse a number written in the specified positional numeral system, failing on overflow. The supplied parser is used to determine the sign of the number.
bounded :: (PositionalSystem s, Ord α, Bounded α, Integral α, Monad μ, CharParsing μ) => s -> μ α Source #
cBounded' :: (PositionalSystem s, Ord α, Bounded α, Integral α, Monad μ, CharParsing μ) => μ Sign -> s -> μ α Source #
Parse a number written in the specified positional numeral system, failing on overflow. The supplied parser is used to determine the sign of the number. Leading zeroes are not allowed.
cBounded :: (PositionalSystem s, Ord α, Bounded α, Integral α, Monad μ, CharParsing μ) => s -> μ α Source #
bits' :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => μ Sign -> s -> μ α Source #
Parse a (two's complement) binary number written in the specified positional numeral system. The supplied parser is used to determine the sign of the number.
cBits' :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => μ Sign -> s -> μ α Source #
Parse a (two's complement) binary number written in the specified positional numeral system. The supplied parser is used to determine the sign of the number. Leading zeroes are not allowed.
bitsUpTo' :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => μ Sign -> s -> Int -> μ α Source #
Parse a (two's complement) binary number written in the specified positional numeral system (up to n digits). The supplied parser is used to determine the sign of the number.
cBitsUpTo' :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => μ Sign -> s -> Int -> μ α Source #
Parse a (two's complement) binary number written in the specified positional numeral system (up to n digits). The supplied parser is used to determine the sign of the number. Leading zeroes are not allowed.
cBitsUpTo :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> Int -> μ α Source #
A shorthand for cBitsUpTo'
optMinus
.
bBits' :: (BitSystem s, Ord α, Bounded α, Num α, Bits α, Monad μ, CharParsing μ) => μ Sign -> s -> μ α Source #
Parse a (two's complement) binary number written in the specified positional numeral system, failing on overflow. The supplied parser is used to determine the sign of the number.
bBits :: (BitSystem s, Ord α, Bounded α, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α Source #
cbBits' :: (BitSystem s, Ord α, Bounded α, Num α, Bits α, Monad μ, CharParsing μ) => μ Sign -> s -> μ α Source #
Parse a (two's complement) binary number written in the specified positional numeral system, failing on overflow. The supplied parser is used to determine the sign of the number. Leading zeroes are not allowed.