B:BD[
3.2354] → [
2.307:599]
payouts :: WorkIndex -> Payouts
payouts widx = let addIntervalDiff total ivals = (\dt -> (dt + total, dt)) $ sumLogIntervals ivals
(totalTime, keyTimes) = M.mapAccum addIntervalDiff (fromInteger 0) $ M.map snd widx
in M.map (\kt -> kt / totalTime) keyTimes
{-|
Payouts are determined by computing a depreciated duration value for
each work interval. This function computes the percentage of the total
work allocated to each address.
-}
payouts :: Depreciation -> UTCTime -> WorkIndex -> Payouts
payouts dep ptime widx = let addIntervalDiff :: (Functor f, Foldable f) => NDT -> f LogInterval -> (NDT, NDT)
addIntervalDiff total ivals = (\dt -> (dt + total, dt)) $ sumLogIntervals dep ptime ivals
(totalTime, keyTimes) = M.mapAccum addIntervalDiff (fromInteger 0) $ M.map snd widx
in M.map (\kt -> toRational $ kt / totalTime) keyTimes
{-|
-}
sumLogIntervals :: (Functor f, Foldable f) => Depreciation -> UTCTime -> f LogInterval -> NDT
sumLogIntervals dep ptime ivals = F.foldl' (+) (fromInteger 0) $ fmap (depreciateInterval dep ptime) ivals