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FYKTUTY74UNZ2FQTT63XZ6HIF3AAC
5DRIWGLUKMQZU2ZPBXSTLAWJKAMOD5YXAHM5LEDQHDFGYYLHWCDQC
EFSXYZPOGA5M4DN65IEIDO7JK6U34DMQELAPHOIL2UAT6HRC66BAC
OBFPJS2GHO2PEHBHGEHKIUOUAFIQHPIZXEVD2YIE3ZIE2PVMH5VAC
workCredit depf ptime ivals =
let intervalCredit ival = (Sum . ilen &&& Sum . depf Nothing ptime) $ fmap (view eventTime) ival
workCredit depf payoutDate ivals =
let intervalCredit ival = (Sum . ilen &&& Sum . depf Nothing payoutDate) $ fmap (view eventTime) ival
(StartWork t, StopWork t') | t' > t -> Right $ Interval e e' -- complete interval found
(StartWork t, StartWork t') -> Left $ if t > t' then e else e' -- ignore redundant starts
(StopWork t, StopWork t') -> Left $ if t <= t' then e else e' -- ignore redundant ends
(StartWork t, StopWork t')
| t' > t ->
-- complete interval found
Right $ Interval e e'
(StartWork t, StartWork t') ->
-- ignore redundant starts
Left $ if t > t' then e else e'
(StopWork t, StopWork t') ->
-- ignore redundant ends
Left $ if t <= t' then e else e'
traceWith :: Show b => (a -> b) -> a -> a
traceWith f a = T.trace (show $ f a) a
import Aftok.Types (UserId (..), DepreciationFunction(..))
import Control.Lens ((^.), view, to)
import Data.AffineSpace ((.-.), (.+^))
import Data.VectorSpace ((*^), Sum (..), (^+^), (^-^), getSum, zeroV)
import Data.Maybe (fromJust)
import Aftok.Types (DepreciationFunction (..), UserId (..))
import Control.Lens ((^.), to, view)
import Data.AffineSpace ((.+^))
. filter (\i -> fst i `mod` 2 == 0)
$ ([(0 :: Int)..] `zip` (timestamps `zip` tail timestamps))
widx = WorkIndex $ M.fromList
[ (u0, L.fromList $ take 10 intervals)
, (u1, L.fromList $ take 30 intervals)
, (u2, L.fromList $ take 120 intervals)
]
. filter (\i -> fst i `mod` 2 == 0)
$ ([(0 :: Int) ..] `zip` (timestamps `zip` tail timestamps))
widx =
WorkIndex $
M.fromList
[ (u0, L.fromList $ take 10 intervals),
(u1, L.fromList $ take 30 intervals),
(u2, L.fromList $ take 120 intervals)
]