penny-lib-0.4.0.0: Extensible double-entry accounting system - library

Safe HaskellSafe-Infered

Penny.Cabin.Posts.Allocate

Synopsis

Documentation

data Allocation Source

Allocations are integers. The absolute value of the integer is used, so for practical purposes -4 is the same allocation as 4.

allocate :: (Functor f, Foldable f, Traversable f) => f Allocation -> Int -> f IntSource

Properties of the allocated result:

  • If the sum of the absolute values of the allocations is zero, then each of the elements in the result will also be zero.
  • Otherwise, if any allocation is zero, then the corresponding amount in the result will also be zero. The sum of the results will equal the total requested.