fromString :: String -> Maybe BigInt
Parse a string into a
Nothing if the parse fails.
Supports decimal, binary, octal, hexadecimal and exponentiation notations.
See MDN for more examples.
fromString "857981209301293808359384092830482" -- 857981209301293808359384092830482 fromString "0b10000000000000000000000000000000" -- 2147483648 fromString "0B00000000011111111111111111111111" -- 8388607 fromString "0O755" -- 493 fromString "0o644" -- 420 fromString "0xFFFFFFFFFFFFFFFFF" -- 295147905179352830000 fromString "0XA" -- 10 fromString "0e-5" -- 0 fromString "5e1" -- 50 fromString "175e-2" -- 1.75 fromString "1E3" -- 1000
The BigInt in the first argument shifted to the right by the number of bits specified in the second argument. Excess bits shifted off to the right are discarded, and copies of the leftmost bit are shifted in from the left. This operation is also called "sign-propagating right shift" or "arithmetic right shift", because the sign of the resulting number is the same as the sign of the first operand.
Re-exports from Data.
The number of unique digits (including zero) used to represent integers in a specific base.
A type for describing whether an integer is even or odd.
Ord instance considers
Even to be less than
Semiring instance allows you to ask about the parity of the results
of arithmetical operations, given only the parities of the inputs. For
example, the sum of an odd number and an even number is odd, so
Odd + Even == Odd. This also works for multiplication, eg. the product
of two odd numbers is odd, and therefore
Odd * Odd == Odd.
More generally, we have that
parity x + parity y == parity (x + y) parity x * parity y == parity (x * y)
for any integers
y. (A mathematician would say that
parity is a
After defining addition and multiplication on
Parity in this way, the
Semiring laws now force us to choose
zero = Even and
one = Odd.
Semiring instance actually turns out to be a