aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sariulccron.hs
blob: fdaf61c716569e1cd9546de718e1dd219b64c3e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import Control.Monad.SariulClocks
import Utils.ScoresFile
import Types.Scores
import Types.Classes
import Control.Monad (liftM, when)

weeklyCron        :: ScoresList -> ScoresList
weeklyCron scores = undefined

main :: IO ()
main = runSariulClocksIO $ do
    scores <- readScoresFile
    when (isJust scores) $ do
        modifyScores weeklyCron
        shouldModify <- liftM (((/=) scores) . Just) getScores
        when shouldModify writeScoresFile

isJust          :: Maybe a -> Bool
isJust (Just _) = True
isJust _        = False