refactored updateGameStats and validageGameDate

This commit is contained in:
Jonathan Lamothe 2019-09-04 00:58:44 -04:00
parent 24f02b427e
commit 5b6ecc8c40

View File

@ -77,9 +77,7 @@ overtimeCheck s
-- | Adjusts the game stats based on the results of the current game
updateGameStats :: ProgState -> ProgState
updateGameStats s = fromMaybe s result
where
result = do
updateGameStats s = fromMaybe s $ do
gType <- s^.progMode.gameStateL.gameType
won <- gameWon $ s^.progMode.gameStateL
lost <- gameLost $ s^.progMode.gameStateL
@ -103,9 +101,7 @@ updateGameStats s = fromMaybe s result
-- | Validates the game date
validateGameDate :: ProgState -> ProgState
validateGameDate s = fromMaybe s result
where
result = do
validateGameDate s = fromMaybe s $ do
y <- toInteger <$> s^.progMode.gameStateL.gameYear
m <- s^.progMode.gameStateL.gameMonth
d <- s^.progMode.gameStateL.gameDay