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4XFRDCG544SBJCYALSKZV45CQQBZ4ACUH2AC
TCOAKCGGHOIRJCTZYEZQ3K6KCGL2LGAYGYFRGSPCHBTJJY2V6AXAC
WFZDMVUXZ2KPTMRAZGEYHKEJTKOKWVYCXKKAKQ7K6I5TMSLBUJ4QC
64VI73NPSFNWTL6UXM6YHRFLNJZ3NUJ2R3CL53MO2HSZWFGBIRTQC
instance FromJSON WorkEvent where
parseJSON (Object jv) =
WorkEvent <$> (jv .: "type" >>= nameEvent) <*> jv .: "timestamp"
parseJSON _ = mzero
instance FromJSON LogEntry where
parseJSON (Object jv) =
LogEntry <$> jv .: "btcAddr" <*> jv .: "workEvent"
parseJSON _ = mzero
(totalTime, keyTimes) = MS.mapAccum addIntervalDiff (fromInteger 0) $ MS.map snd widx
in MS.map (\kt -> toRational $ kt / totalTime) keyTimes
(totalTime, keyTimes) = MS.mapAccum addIntervalDiff (fromInteger 0) $ widx
in fmap (\kt -> toRational $ kt / totalTime) keyTimes
-- data LogEventParseError = LogEventParseError String deriving (Show, Typeable)
-- instance Exception LogEventParseError where
-- instance FromField WorkEvent where
-- fromField f m = let fromText "start_work" = return StartWork
-- fromText "stop_work" = return StopWork
-- fromText a = conversionError $ LogEventParseError $ "unrecognized log event type " ++ a
-- in fromField f m >>= fromText
-- instance FromRow LogEntry where
-- fromRow = LogEntry <$> field <*> field <*> field