Copyright  (c) Henning Thielemann 20072010 

Maintainer  haskell@henningthielemann.de 
Stability  stable 
Portability  Haskell 98 
Safe Haskell  None 
Language  Haskell98 
A lazy number type, which is a generalization of lazy Peano numbers.
Comparisons can be made lazy and
thus computations are possible which are impossible with strict number types,
e.g. you can compute let y = min (1+y) 2 in y
.
You can even work with infinite values.
However, depending on the granularity,
the memory consumption is higher than that for strict number types.
This number type is of interest for the merge operation of event lists,
which allows for corecursive merges.
Synopsis
 data T a
 fromChunks :: C a => [a] > T a
 toChunks :: C a => T a > [a]
 fromNumber :: C a => a > T a
 toNumber :: C a => T a > a
 fromChunky98 :: (C a, C a) => T a > T a
 toChunky98 :: (C a, C a) => T a > T a
 minMaxDiff :: C a => T a > T a > (T a, (Bool, T a))
 normalize :: C a => T a > T a
 isNull :: C a => T a > Bool
 isPositive :: C a => T a > Bool
 divModLazy :: (C a, C a) => T a > T a > (T a, T a)
 divModStrict :: (C a, C a) => T a > a > (T a, a)
Documentation
A chunky nonnegative number is a list of nonnegative 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 Chunky
.
Instances
C a => Eq (T a) Source #  
(C a, Fractional a) => Fractional (T a) Source #  
(C a, Num a) => Num (T a) Source #  
C a => Ord (T a) Source #  
Show a => Show (T a) Source #  
C a => Semigroup (T a) Source #  
C a => Monoid (T a) Source #  
(C a, Arbitrary a) => Arbitrary (T a) Source #  
C a => C (T a) Source #  
C a => C (T a) Source #  
(C a, C a) => C (T a) Source #  
C a => C (T a) Source #  
C a => C (T a) Source #  
(Ord a, C a, C a) => C (T a) Source # 

(C a, C a, C a) => C (T a) Source #  
(C a, C a) => C (T a) Source #  
Defined in Number.NonNegativeChunky toRational :: T a > Rational Source #  
(C a, C a) => C (T a) Source #  
(C a, C a) => C (T a) Source #  
fromChunks :: C a => [a] > T a Source #
fromNumber :: C a => a > T a Source #
divModLazy :: (C a, C a) => T a > T a > (T a, T a) Source #
divModLazy accesses the divisor in a lazy way. However this is only relevant if the dividend is smaller than the divisor. For large dividends the divisor will be accessed multiple times but since it is already fully evaluated it could also be strict.