data-textual-0.3.0.3: Human-friendly textual representations.
Safe HaskellNone
LanguageHaskell2010

Data.Textual.Integral

Description

Parsers for integral numbers written in positional numeral systems.

Synopsis

Positional numeral systems

class PositionalSystem s where #

Methods

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 #

Instances

Instances details
PositionalSystem Binary 
Instance details

Defined in Text.Printer.Integral

Methods

systemName :: Binary -> String #

radixIn :: Num α => Binary -> α #

isDigitIn :: Binary -> Char -> Bool #

isNzDigitIn :: Binary -> Char -> Bool #

fromDigitIn :: Num α => Binary -> Char -> Maybe α #

fromNzDigitIn :: Num α => Binary -> Char -> Maybe α #

unsafeFromDigitIn :: Num α => Binary -> Char -> α #

intToDigitIn :: Binary -> Int -> Char #

printDigitIn :: Printer p => Binary -> Char -> p #

printZeroIn :: Printer p => Binary -> p #

PositionalSystem Decimal 
Instance details

Defined in Text.Printer.Integral

Methods

systemName :: Decimal -> String #

radixIn :: Num α => Decimal -> α #

isDigitIn :: Decimal -> Char -> Bool #

isNzDigitIn :: Decimal -> Char -> Bool #

fromDigitIn :: Num α => Decimal -> Char -> Maybe α #

fromNzDigitIn :: Num α => Decimal -> Char -> Maybe α #

unsafeFromDigitIn :: Num α => Decimal -> Char -> α #

intToDigitIn :: Decimal -> Int -> Char #

printDigitIn :: Printer p => Decimal -> Char -> p #

printZeroIn :: Printer p => Decimal -> p #

PositionalSystem Hexadecimal 
Instance details

Defined in Text.Printer.Integral

Methods

systemName :: Hexadecimal -> String #

radixIn :: Num α => Hexadecimal -> α #

isDigitIn :: Hexadecimal -> Char -> Bool #

isNzDigitIn :: Hexadecimal -> Char -> Bool #

fromDigitIn :: Num α => Hexadecimal -> Char -> Maybe α #

fromNzDigitIn :: Num α => Hexadecimal -> Char -> Maybe α #

unsafeFromDigitIn :: Num α => Hexadecimal -> Char -> α #

intToDigitIn :: Hexadecimal -> Int -> Char #

printDigitIn :: Printer p => Hexadecimal -> Char -> p #

printZeroIn :: Printer p => Hexadecimal -> p #

PositionalSystem LowHex 
Instance details

Defined in Text.Printer.Integral

Methods

systemName :: LowHex -> String #

radixIn :: Num α => LowHex -> α #

isDigitIn :: LowHex -> Char -> Bool #

isNzDigitIn :: LowHex -> Char -> Bool #

fromDigitIn :: Num α => LowHex -> Char -> Maybe α #

fromNzDigitIn :: Num α => LowHex -> Char -> Maybe α #

unsafeFromDigitIn :: Num α => LowHex -> Char -> α #

intToDigitIn :: LowHex -> Int -> Char #

printDigitIn :: Printer p => LowHex -> Char -> p #

printZeroIn :: Printer p => LowHex -> p #

PositionalSystem Octal 
Instance details

Defined in Text.Printer.Integral

Methods

systemName :: Octal -> String #

radixIn :: Num α => Octal -> α #

isDigitIn :: Octal -> Char -> Bool #

isNzDigitIn :: Octal -> Char -> Bool #

fromDigitIn :: Num α => Octal -> Char -> Maybe α #

fromNzDigitIn :: Num α => Octal -> Char -> Maybe α #

unsafeFromDigitIn :: Num α => Octal -> Char -> α #

intToDigitIn :: Octal -> Int -> Char #

printDigitIn :: Printer p => Octal -> Char -> p #

printZeroIn :: Printer p => Octal -> p #

PositionalSystem UpHex 
Instance details

Defined in Text.Printer.Integral

Methods

systemName :: UpHex -> String #

radixIn :: Num α => UpHex -> α #

isDigitIn :: UpHex -> Char -> Bool #

isNzDigitIn :: UpHex -> Char -> Bool #

fromDigitIn :: Num α => UpHex -> Char -> Maybe α #

fromNzDigitIn :: Num α => UpHex -> Char -> Maybe α #

unsafeFromDigitIn :: Num α => UpHex -> Char -> α #

intToDigitIn :: UpHex -> Int -> Char #

printDigitIn :: Printer p => UpHex -> Char -> p #

printZeroIn :: Printer p => UpHex -> p #

class PositionalSystem s => BitSystem s where #

Methods

digitBitsIn :: s -> Int #

digitMaskIn :: Num α => s -> α #

lastDigitIn :: Bits α => s -> α -> Int #

Instances

Instances details
BitSystem Binary 
Instance details

Defined in Text.Printer.Integral

Methods

digitBitsIn :: Binary -> Int #

digitMaskIn :: Num α => Binary -> α #

lastDigitIn :: Bits α => Binary -> α -> Int #

BitSystem Hexadecimal 
Instance details

Defined in Text.Printer.Integral

Methods

digitBitsIn :: Hexadecimal -> Int #

digitMaskIn :: Num α => Hexadecimal -> α #

lastDigitIn :: Bits α => Hexadecimal -> α -> Int #

BitSystem LowHex 
Instance details

Defined in Text.Printer.Integral

Methods

digitBitsIn :: LowHex -> Int #

digitMaskIn :: Num α => LowHex -> α #

lastDigitIn :: Bits α => LowHex -> α -> Int #

BitSystem Octal 
Instance details

Defined in Text.Printer.Integral

Methods

digitBitsIn :: Octal -> Int #

digitMaskIn :: Num α => Octal -> α #

lastDigitIn :: Bits α => Octal -> α -> Int #

BitSystem UpHex 
Instance details

Defined in Text.Printer.Integral

Methods

digitBitsIn :: UpHex -> Int #

digitMaskIn :: Num α => UpHex -> α #

lastDigitIn :: Bits α => UpHex -> α -> Int #

data Binary #

Constructors

Binary 

Instances

Instances details
Eq Binary 
Instance details

Defined in Text.Printer.Integral

Methods

(==) :: Binary -> Binary -> Bool

(/=) :: Binary -> Binary -> Bool

Ord Binary 
Instance details

Defined in Text.Printer.Integral

Methods

compare :: Binary -> Binary -> Ordering

(<) :: Binary -> Binary -> Bool

(<=) :: Binary -> Binary -> Bool

(>) :: Binary -> Binary -> Bool

(>=) :: Binary -> Binary -> Bool

max :: Binary -> Binary -> Binary

min :: Binary -> Binary -> Binary

Read Binary 
Instance details

Defined in Text.Printer.Integral

Methods

readsPrec :: Int -> ReadS Binary

readList :: ReadS [Binary]

readPrec :: ReadPrec Binary

readListPrec :: ReadPrec [Binary]

Show Binary 
Instance details

Defined in Text.Printer.Integral

Methods

showsPrec :: Int -> Binary -> ShowS

show :: Binary -> String

showList :: [Binary] -> ShowS

Generic Binary 
Instance details

Defined in Text.Printer.Integral

Associated Types

type Rep Binary :: Type -> Type

Methods

from :: Binary -> Rep Binary x

to :: Rep Binary x -> Binary

BitSystem Binary 
Instance details

Defined in Text.Printer.Integral

Methods

digitBitsIn :: Binary -> Int #

digitMaskIn :: Num α => Binary -> α #

lastDigitIn :: Bits α => Binary -> α -> Int #

PositionalSystem Binary 
Instance details

Defined in Text.Printer.Integral

Methods

systemName :: Binary -> String #

radixIn :: Num α => Binary -> α #

isDigitIn :: Binary -> Char -> Bool #

isNzDigitIn :: Binary -> Char -> Bool #

fromDigitIn :: Num α => Binary -> Char -> Maybe α #

fromNzDigitIn :: Num α => Binary -> Char -> Maybe α #

unsafeFromDigitIn :: Num α => Binary -> Char -> α #

intToDigitIn :: Binary -> Int -> Char #

printDigitIn :: Printer p => Binary -> Char -> p #

printZeroIn :: Printer p => Binary -> p #

type Rep Binary 
Instance details

Defined in Text.Printer.Integral

type Rep Binary = D1 ('MetaData "Binary" "Text.Printer.Integral" "text-printer-0.5.0.2-1aEyTWsmD2GJfkfpMLV1tQ" 'False) (C1 ('MetaCons "Binary" 'PrefixI 'False) (U1 :: Type -> Type))

data Octal #

Constructors

Octal 

Instances

Instances details
Eq Octal 
Instance details

Defined in Text.Printer.Integral

Methods

(==) :: Octal -> Octal -> Bool

(/=) :: Octal -> Octal -> Bool

Ord Octal 
Instance details

Defined in Text.Printer.Integral

Methods

compare :: Octal -> Octal -> Ordering

(<) :: Octal -> Octal -> Bool

(<=) :: Octal -> Octal -> Bool

(>) :: Octal -> Octal -> Bool

(>=) :: Octal -> Octal -> Bool

max :: Octal -> Octal -> Octal

min :: Octal -> Octal -> Octal

Read Octal 
Instance details

Defined in Text.Printer.Integral

Methods

readsPrec :: Int -> ReadS Octal

readList :: ReadS [Octal]

readPrec :: ReadPrec Octal

readListPrec :: ReadPrec [Octal]

Show Octal 
Instance details

Defined in Text.Printer.Integral

Methods

showsPrec :: Int -> Octal -> ShowS

show :: Octal -> String

showList :: [Octal] -> ShowS

Generic Octal 
Instance details

Defined in Text.Printer.Integral

Associated Types

type Rep Octal :: Type -> Type

Methods

from :: Octal -> Rep Octal x

to :: Rep Octal x -> Octal

BitSystem Octal 
Instance details

Defined in Text.Printer.Integral

Methods

digitBitsIn :: Octal -> Int #

digitMaskIn :: Num α => Octal -> α #

lastDigitIn :: Bits α => Octal -> α -> Int #

PositionalSystem Octal 
Instance details

Defined in Text.Printer.Integral

Methods

systemName :: Octal -> String #

radixIn :: Num α => Octal -> α #

isDigitIn :: Octal -> Char -> Bool #

isNzDigitIn :: Octal -> Char -> Bool #

fromDigitIn :: Num α => Octal -> Char -> Maybe α #

fromNzDigitIn :: Num α => Octal -> Char -> Maybe α #

unsafeFromDigitIn :: Num α => Octal -> Char -> α #

intToDigitIn :: Octal -> Int -> Char #

printDigitIn :: Printer p => Octal -> Char -> p #

printZeroIn :: Printer p => Octal -> p #

type Rep Octal 
Instance details

Defined in Text.Printer.Integral

type Rep Octal = D1 ('MetaData "Octal" "Text.Printer.Integral" "text-printer-0.5.0.2-1aEyTWsmD2GJfkfpMLV1tQ" 'False) (C1 ('MetaCons "Octal" 'PrefixI 'False) (U1 :: Type -> Type))

data Decimal #

Constructors

Decimal 

Instances

Instances details
Eq Decimal 
Instance details

Defined in Text.Printer.Integral

Methods

(==) :: Decimal -> Decimal -> Bool

(/=) :: Decimal -> Decimal -> Bool

Ord Decimal 
Instance details

Defined in Text.Printer.Integral

Methods

compare :: Decimal -> Decimal -> Ordering

(<) :: Decimal -> Decimal -> Bool

(<=) :: Decimal -> Decimal -> Bool

(>) :: Decimal -> Decimal -> Bool

(>=) :: Decimal -> Decimal -> Bool

max :: Decimal -> Decimal -> Decimal

min :: Decimal -> Decimal -> Decimal

Read Decimal 
Instance details

Defined in Text.Printer.Integral

Methods

readsPrec :: Int -> ReadS Decimal

readList :: ReadS [Decimal]

readPrec :: ReadPrec Decimal

readListPrec :: ReadPrec [Decimal]

Show Decimal 
Instance details

Defined in Text.Printer.Integral

Methods

showsPrec :: Int -> Decimal -> ShowS

show :: Decimal -> String

showList :: [Decimal] -> ShowS

Generic Decimal 
Instance details

Defined in Text.Printer.Integral

Associated Types

type Rep Decimal :: Type -> Type

Methods

from :: Decimal -> Rep Decimal x

to :: Rep Decimal x -> Decimal

PositionalSystem Decimal 
Instance details

Defined in Text.Printer.Integral

Methods

systemName :: Decimal -> String #

radixIn :: Num α => Decimal -> α #

isDigitIn :: Decimal -> Char -> Bool #

isNzDigitIn :: Decimal -> Char -> Bool #

fromDigitIn :: Num α => Decimal -> Char -> Maybe α #

fromNzDigitIn :: Num α => Decimal -> Char -> Maybe α #

unsafeFromDigitIn :: Num α => Decimal -> Char -> α #

intToDigitIn :: Decimal -> Int -> Char #

printDigitIn :: Printer p => Decimal -> Char -> p #

printZeroIn :: Printer p => Decimal -> p #

type Rep Decimal 
Instance details

Defined in Text.Printer.Integral

type Rep Decimal = D1 ('MetaData "Decimal" "Text.Printer.Integral" "text-printer-0.5.0.2-1aEyTWsmD2GJfkfpMLV1tQ" 'False) (C1 ('MetaCons "Decimal" 'PrefixI 'False) (U1 :: Type -> Type))

data Hexadecimal #

Constructors

Hexadecimal 

Instances

Instances details
Eq Hexadecimal 
Instance details

Defined in Text.Printer.Integral

Methods

(==) :: Hexadecimal -> Hexadecimal -> Bool

(/=) :: Hexadecimal -> Hexadecimal -> Bool

Ord Hexadecimal 
Instance details

Defined in Text.Printer.Integral

Read Hexadecimal 
Instance details

Defined in Text.Printer.Integral

Methods

readsPrec :: Int -> ReadS Hexadecimal

readList :: ReadS [Hexadecimal]

readPrec :: ReadPrec Hexadecimal

readListPrec :: ReadPrec [Hexadecimal]

Show Hexadecimal 
Instance details

Defined in Text.Printer.Integral

Methods

showsPrec :: Int -> Hexadecimal -> ShowS

show :: Hexadecimal -> String

showList :: [Hexadecimal] -> ShowS

Generic Hexadecimal 
Instance details

Defined in Text.Printer.Integral

Associated Types

type Rep Hexadecimal :: Type -> Type

Methods

from :: Hexadecimal -> Rep Hexadecimal x

to :: Rep Hexadecimal x -> Hexadecimal

BitSystem Hexadecimal 
Instance details

Defined in Text.Printer.Integral

Methods

digitBitsIn :: Hexadecimal -> Int #

digitMaskIn :: Num α => Hexadecimal -> α #

lastDigitIn :: Bits α => Hexadecimal -> α -> Int #

PositionalSystem Hexadecimal 
Instance details

Defined in Text.Printer.Integral

Methods

systemName :: Hexadecimal -> String #

radixIn :: Num α => Hexadecimal -> α #

isDigitIn :: Hexadecimal -> Char -> Bool #

isNzDigitIn :: Hexadecimal -> Char -> Bool #

fromDigitIn :: Num α => Hexadecimal -> Char -> Maybe α #

fromNzDigitIn :: Num α => Hexadecimal -> Char -> Maybe α #

unsafeFromDigitIn :: Num α => Hexadecimal -> Char -> α #

intToDigitIn :: Hexadecimal -> Int -> Char #

printDigitIn :: Printer p => Hexadecimal -> Char -> p #

printZeroIn :: Printer p => Hexadecimal -> p #

type Rep Hexadecimal 
Instance details

Defined in Text.Printer.Integral

type Rep Hexadecimal = D1 ('MetaData "Hexadecimal" "Text.Printer.Integral" "text-printer-0.5.0.2-1aEyTWsmD2GJfkfpMLV1tQ" 'False) (C1 ('MetaCons "Hexadecimal" 'PrefixI 'False) (U1 :: Type -> Type))

data LowHex #

Constructors

LowHex 

Instances

Instances details
Eq LowHex 
Instance details

Defined in Text.Printer.Integral

Methods

(==) :: LowHex -> LowHex -> Bool

(/=) :: LowHex -> LowHex -> Bool

Ord LowHex 
Instance details

Defined in Text.Printer.Integral

Methods

compare :: LowHex -> LowHex -> Ordering

(<) :: LowHex -> LowHex -> Bool

(<=) :: LowHex -> LowHex -> Bool

(>) :: LowHex -> LowHex -> Bool

(>=) :: LowHex -> LowHex -> Bool

max :: LowHex -> LowHex -> LowHex

min :: LowHex -> LowHex -> LowHex

Read LowHex 
Instance details

Defined in Text.Printer.Integral

Methods

readsPrec :: Int -> ReadS LowHex

readList :: ReadS [LowHex]

readPrec :: ReadPrec LowHex

readListPrec :: ReadPrec [LowHex]

Show LowHex 
Instance details

Defined in Text.Printer.Integral

Methods

showsPrec :: Int -> LowHex -> ShowS

show :: LowHex -> String

showList :: [LowHex] -> ShowS

Generic LowHex 
Instance details

Defined in Text.Printer.Integral

Associated Types

type Rep LowHex :: Type -> Type

Methods

from :: LowHex -> Rep LowHex x

to :: Rep LowHex x -> LowHex

BitSystem LowHex 
Instance details

Defined in Text.Printer.Integral

Methods

digitBitsIn :: LowHex -> Int #

digitMaskIn :: Num α => LowHex -> α #

lastDigitIn :: Bits α => LowHex -> α -> Int #

PositionalSystem LowHex 
Instance details

Defined in Text.Printer.Integral

Methods

systemName :: LowHex -> String #

radixIn :: Num α => LowHex -> α #

isDigitIn :: LowHex -> Char -> Bool #

isNzDigitIn :: LowHex -> Char -> Bool #

fromDigitIn :: Num α => LowHex -> Char -> Maybe α #

fromNzDigitIn :: Num α => LowHex -> Char -> Maybe α #

unsafeFromDigitIn :: Num α => LowHex -> Char -> α #

intToDigitIn :: LowHex -> Int -> Char #

printDigitIn :: Printer p => LowHex -> Char -> p #

printZeroIn :: Printer p => LowHex -> p #

type Rep LowHex 
Instance details

Defined in Text.Printer.Integral

type Rep LowHex = D1 ('MetaData "LowHex" "Text.Printer.Integral" "text-printer-0.5.0.2-1aEyTWsmD2GJfkfpMLV1tQ" 'False) (C1 ('MetaCons "LowHex" 'PrefixI 'False) (U1 :: Type -> Type))

data UpHex #

Constructors

UpHex 

Instances

Instances details
Eq UpHex 
Instance details

Defined in Text.Printer.Integral

Methods

(==) :: UpHex -> UpHex -> Bool

(/=) :: UpHex -> UpHex -> Bool

Ord UpHex 
Instance details

Defined in Text.Printer.Integral

Methods

compare :: UpHex -> UpHex -> Ordering

(<) :: UpHex -> UpHex -> Bool

(<=) :: UpHex -> UpHex -> Bool

(>) :: UpHex -> UpHex -> Bool

(>=) :: UpHex -> UpHex -> Bool

max :: UpHex -> UpHex -> UpHex

min :: UpHex -> UpHex -> UpHex

Read UpHex 
Instance details

Defined in Text.Printer.Integral

Methods

readsPrec :: Int -> ReadS UpHex

readList :: ReadS [UpHex]

readPrec :: ReadPrec UpHex

readListPrec :: ReadPrec [UpHex]

Show UpHex 
Instance details

Defined in Text.Printer.Integral

Methods

showsPrec :: Int -> UpHex -> ShowS

show :: UpHex -> String

showList :: [UpHex] -> ShowS

Generic UpHex 
Instance details

Defined in Text.Printer.Integral

Associated Types

type Rep UpHex :: Type -> Type

Methods

from :: UpHex -> Rep UpHex x

to :: Rep UpHex x -> UpHex

BitSystem UpHex 
Instance details

Defined in Text.Printer.Integral

Methods

digitBitsIn :: UpHex -> Int #

digitMaskIn :: Num α => UpHex -> α #

lastDigitIn :: Bits α => UpHex -> α -> Int #

PositionalSystem UpHex 
Instance details

Defined in Text.Printer.Integral

Methods

systemName :: UpHex -> String #

radixIn :: Num α => UpHex -> α #

isDigitIn :: UpHex -> Char -> Bool #

isNzDigitIn :: UpHex -> Char -> Bool #

fromDigitIn :: Num α => UpHex -> Char -> Maybe α #

fromNzDigitIn :: Num α => UpHex -> Char -> Maybe α #

unsafeFromDigitIn :: Num α => UpHex -> Char -> α #

intToDigitIn :: UpHex -> Int -> Char #

printDigitIn :: Printer p => UpHex -> Char -> p #

printZeroIn :: Printer p => UpHex -> p #

type Rep UpHex 
Instance details

Defined in Text.Printer.Integral

type Rep UpHex = D1 ('MetaData "UpHex" "Text.Printer.Integral" "text-printer-0.5.0.2-1aEyTWsmD2GJfkfpMLV1tQ" 'False) (C1 ('MetaCons "UpHex" 'PrefixI 'False) (U1 :: Type -> Type))

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.

data Sign Source #

Sign of a number.

Constructors

NonNegative 
NonPositive 

Instances

Instances details
Eq Sign Source # 
Instance details

Defined in Data.Textual.Integral

Methods

(==) :: Sign -> Sign -> Bool

(/=) :: Sign -> Sign -> Bool

Read Sign Source # 
Instance details

Defined in Data.Textual.Integral

Methods

readsPrec :: Int -> ReadS Sign

readList :: ReadS [Sign]

readPrec :: ReadPrec Sign

readListPrec :: ReadPrec [Sign]

Show Sign Source # 
Instance details

Defined in Data.Textual.Integral

Methods

showsPrec :: Int -> Sign -> ShowS

show :: Sign -> String

showList :: [Sign] -> ShowS

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 #

A shorthand for number' optMinus.

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 #

A shorthand for compact' optMinus.

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 #

A shorthand for bounded' optMinus.

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 #

A shorthand for cBounded' optMinus.

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.

bits :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α Source #

A shorthand for bits' optMinus.

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.

cBits :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α Source #

A shorthand for cBits' optMinus.

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.

bitsUpTo :: (BitSystem s, Num α, Bits α, Monad μ, CharParsing μ) => s -> Int -> μ α Source #

A shorthand for bitsUpTo' optMinus.

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 #

A shorthand for bBits' optMinus.

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.

cbBits :: (BitSystem s, Ord α, Bounded α, Num α, Bits α, Monad μ, CharParsing μ) => s -> μ α Source #

A shorthand for cbBits' optMinus.