Skip to content

Commit

Permalink
adding comments and inline and removing prop test results
Browse files Browse the repository at this point in the history
  • Loading branch information
travgm committed Nov 14, 2024
1 parent d19f5db commit 346c882
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Lib/DecimalTime.hs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ localTimeToDecimal s = do
setCurrentDate :: ZonedTime -> ClockState -> ClockState
setCurrentDate zt state = state & (currentDate ?~ zonedTimeToLocalTime zt)

-- | Check if the alarm time has been reached
{-# INLINE checkAlarmTime #-}
checkAlarmTime :: ClockState -> Maybe DecimalTime
checkAlarmTime s = do
alarm <- s ^. alarmTime
Expand All @@ -118,6 +120,8 @@ checkAlarmTime s = do
then Just decimal
else Nothing

-- | Check the status of the time
{-# INLINE checkTimeStatus #-}
checkTimeStatus :: Either String ClockState -> TimeStatus
checkTimeStatus (Left err) = Error err
checkTimeStatus (Right state) = case checkAlarmTime state of
Expand Down
2 changes: 1 addition & 1 deletion Lib/PrettyPrinter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ formatTime status state = case (status, state) of
(Error err, _) ->
"Decimal time: " <> T.pack err
(AlarmReached _, Right s) ->
baseTimeText s <> " ALARM!" -- Just append ALARM! to normal output
baseTimeText s <> " ALARM!"
(Normal, Right s) ->
baseTimeText s
(_, _) ->
Expand Down

0 comments on commit 346c882

Please sign in to comment.