úÎ(†&B      Haskell 98stablehaskell@henning-thielemann.de9Instances of this class must ensure non-negative values. ?We cannot enforce this by types, but the type class constraint  NonNegative.C Cavoids accidental usage of types which allow for negative numbers.  x -| y == max 0 (x-y)-The default implementation is not efficient, F because it compares the values and then subtracts, again, if safe.   max 0 (x-y) is more elegant and efficient ) but not possible in the general case,  since x-y& may already yield a negative number.  Haskell 98stablehaskell@henning-thielemann.de +Convert a number to a non-negative number. 3If a negative number is given, an error is raised. >name of the calling function to be used in the error message  +Convert a number to a non-negative number. ,A negative number will be replaced by zero. 4Use this function with care since it may hide bugs. ?Wrap a number into a non-negative number without doing checks. 4This routine exists entirely for efficiency reasons >and must be used only in cases where you are absolutely sure, 'that the input number is non-negative. (Results are not checked for positivity. !(Results are not checked for positivity.      Haskell 98stablehaskell@henning-thielemann.de@A chunky non-negative number is a list of non-negative numbers. ,It represents the sum of the list elements. HIt is possible to represent a finite number with infinitely many chunks &by using an infinite number of zeros. Note the following problems: 9Addition 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. "#=This routine exposes the inner structure of the lazy number. $Remove zero chunks. %&'In glue x y == (z,r,b) z represents min x y, r represents max x y - min x y, and x y == b or x>y ==> not b, for x==y the value of b is arbitrary. ()*+<This routine exposes the inner structure of the lazy number and is actually the same as . It was considered dangerous, 'but you can observe the lazy structure 'in tying-the-knot applications anyway. @So the explicit revelation of the chunks seems not to be worse.    Haskell 98stablehaskell@henning-thielemann.de  ,      !"#$%$&'()*+,-non-negative-0.0.4Numeric.NonNegative.ClassNumeric.NonNegative.Wrapper!Numeric.NonNegative.ChunkyPrivateNumeric.NonNegative.UtilityNumeric.NonNegative.ChunkyC-|DoubleFloatRationalRatioIntegerIntT fromNumber fromNumberMsgfromNumberClipfromNumberUnsafetoNumber fromChunkstoChunkszero normalizeisNull isPositivefromChunksUnsafetoChunksUnsafemapPairmapFstmapSndConsunwrapfromNumberWrapliftliftWraplift2decons isNullListcheckglue equalList compareListminListmaxList