Remove `Maybe's` in `JobLog`
My proposal is to change definition of JobLog
to:
data JobLog = JobLog
{ _scst_succeeded :: !Int
, _scst_failed :: !Int
, _scst_remaining :: !Int
, _scst_events :: ![ScraperEvent]
}
i.e. remove Maybe
in all these fields. Also, for ScraperEvent
:
data ScraperEvent = ScraperEvent
{ _scev_message :: !Text
, _scev_level :: !Text
}
i.e. remove Maybe's
as well. Also, I don't see any usages of _scev_date
and I propose to remove it, because it requires going into the IO monad to fetch current time.
The reasons for this are justified in !429 (comment 14838).
Also, make JobLog
a Semigroup
instance so we can remove noJobLog
and just use mempty
. We could redefine G.A.Jobs
a bit. E.g. instead of having addErrorEvent
, addWarningEvent
, addEvent
we could just have:
myJobLog <> (mkEvent "ERROR" msg)
where
mkEvent lvl msg = JobLog 0 0 0 [ ScraperEvent msg lvl ]