Safe Haskell | None |
---|
Print fractions.
- 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
- data Optional
- isOptional :: Optional -> Bool
- isRequired :: Optional -> Bool
- fraction' :: (PositionalSystem s, Real α, Printer p) => s -> p -> p -> p -> p -> Optional -> α -> p
- fraction :: (Real α, Printer p) => α -> p
Positional numeral systems
class PositionalSystem s whereSource
Positional numeral system.
systemName :: s -> StringSource
The name of the system (e.g. "binary", "decimal").
radixIn :: Num α => s -> αSource
The radix of the system.
isDigitIn :: s -> Char -> BoolSource
Test if a character is a digit.
isNzDigitIn :: s -> Char -> BoolSource
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 -> CharSource
Map Int
values to the corresponding digits. Inputs must be
non-negative and less than the radix.
printDigitIn :: Printer p => s -> Char -> pSource
Print a digit.
printZeroIn :: Printer p => s -> pSource
class PositionalSystem s => BitSystem s whereSource
Positonal numeral system with a power of two radix.
digitBitsIn :: s -> IntSource
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 -> α -> IntSource
Map the last digit of a number to the corresponding Int
value.
The binary numeral system.
The octal numeral system.
The decimal numeral system.
data Hexadecimal Source
The hexadecimal numeral system.
The hexadecimal numeral system, using lower case digits.
The hexadecimal numeral system, using upper case digits.
Optionality characteristic
Optionality characteristic.
isOptional :: Optional -> BoolSource
True if the supplied value is Optional
and false otherwise.
isRequired :: Optional -> BoolSource
True if the supplied value is Required
and false otherwise.
Fraction printers
:: (PositionalSystem s, Real α, Printer p) | |
=> s | |
-> p | Prefix for negative values |
-> p | Zero printer |
-> p | Prefix for positive values |
-> p | Numerator/denominator separator |
-> Optional | Whether to print invisible denominators |
-> α | |
-> p |
Print a fraction, writing the numerator and the denominator in the specified positional numeral system.