A chunky non-negative number is a list of non-negative numbers. It represents the sum of the list elements. It is possible to represent a finite number with infinitely many chunks by using an infinite number of zeros.
Note the following problems:
Addition is commutative only for finite representations.
E.g. let y = min (1+y) 2 in y is defined,
let y = min (y+1) 2 in y is not.
The type is equivalent to Numeric.NonNegative.Chunky.
Instances18Eq, Fractional, Num, Ord, Show, Semigroup, …
C a => Eq (T a)Defined in numeric-prelude-0.4.4 · Number.NonNegativeChunky(C a, Fractional a) => Fractional (T a)Defined in numeric-prelude-0.4.4 · Number.NonNegativeChunky(C a, Num a) => Num (T a)Defined in numeric-prelude-0.4.4 · Number.NonNegativeChunkyC a => Ord (T a)Defined in numeric-prelude-0.4.4 · Number.NonNegativeChunkyShow a => Show (T a)Defined in numeric-prelude-0.4.4 · Number.NonNegativeChunkyC a => Semigroup (T a)Defined in numeric-prelude-0.4.4 · Number.NonNegativeChunkyC a => Monoid (T a)Defined in numeric-prelude-0.4.4 · Number.NonNegativeChunky(C a, Arbitrary a) => Arbitrary (T a)Defined in numeric-prelude-0.4.4 · Number.NonNegativeChunky(C a, C a, C a) => C (T a)Defined in numeric-prelude-0.4.4 · Number.NonNegativeChunky(C a, C a) => C (T a)Defined in numeric-prelude-0.4.4 · Number.NonNegativeChunkyC a => C (T a)Defined in numeric-prelude-0.4.4 · Number.NonNegativeChunky(C a, C a) => C (T a)Defined in numeric-prelude-0.4.4 · Number.NonNegativeChunky(C a, C a) => C (T a)Defined in numeric-prelude-0.4.4 · Number.NonNegativeChunky(Ord a, C a, C a) => C (T a)Defined in numeric-prelude-0.4.4 · Number.NonNegativeChunkydivMod is implemented in terms of divModStrict. If it is needed we could also provide a function that accesses the divisor first in a lazy way and then uses a strict divisor for subsequent rounds of the subtraction loop. This way we can handle the cases "dividend smaller than divisor" and "dividend greater than divisor" in a lazy and efficient way. However changing the way of operation within one number is also not nice.
C a => C (T a)Defined in numeric-prelude-0.4.4 · Number.NonNegativeChunkyC a => C (T a)Defined in numeric-prelude-0.4.4 · Number.NonNegativeChunkyC a => C (T a)Defined in numeric-prelude-0.4.4 · Number.NonNegativeChunky(C a, C a) => C (T a)Defined in numeric-prelude-0.4.4 · Number.NonNegativeChunky