GKGVYBZGPJXO7N7GLHLRNYQPXFHBQSNQN53OKRFCXLQEYDTC5I4QC
P6NR2CGXCWAW6GXXSIXCGOBIRAS2BM4LEM6D5ADPN4IL7TMW6UVAC
2KZPOGRBY6KBMO76F55ZKIVOLSG3O63VP3RHRZVANXYT3OLZ3OWQC
EQXRXRZDYCM7BDAVBOXQYPG6C7IJT3OFGNIXCDAHJJBRKAXNGL7AC
ADMKQQGCGVSHHIMVQ4XFRDCG544SBJCYALSKZV45CQQBZ4ACUH2AC
NMWWP4ZNOKHZKSJ6F5KYEREWXXR5F4UD35WOKI3EH42AZWVCTCJAC
Y35QCWYW2OTZ27ZVTH2BA3XJTUCJ2WMLKU32ZCOCDY3AW7TIZXRAC
NVOCQVASZWTKQJG7GPH7KHKZZR7NUG4WLV5YY4KAIRPCJRWCZPIAC
4QX5E5ACVN57KJLCWOM4JEI6JSV4XZNCWVYPOTKSOMUW3SOMCNJAC
7DBNV3GV773FH5ZLQWFX4RBOS4Q3CIK2RYZNNABY3ZOETYZCXRNQC
N4NDAZYTLSI2W22KT3SYXL257DBMSH3UT2BXOYM7LH7FSZAY4RLAC
data LogEventParseError = LogEventParseError String deriving (Show, Typeable)
instance Exception LogEventParseError where
instance FromJSON WorkEvent where
parseJSON (Object jv) = do
t <- jv .: "type" :: A.Parser T.Text
case t of
"start" -> StartWork <$> jv .: "timestamp"
"stop" -> StopWork <$> jv .: "timestamp"
_ -> mzero
-- 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
data LogEntry = LogEntry
{ btcAddr :: BtcAddr
, event :: WorkEvent
} deriving (Show, Eq)
data LogEntry = LogEntry { btcAddr :: BtcAddr
, event :: WorkEvent
} deriving (Show, Eq)
instance FromJSON LogEntry where
parseJSON (Object jv) = LogEntry <$>
jv .: "btcAddr" <*>
jv .: "workEvent"
let depf = undefined
Depreciation depf
let depf ndt = undefined
in Depreciation depf
-- 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