module Update.UpdateTimer ( TimerAction(..) , updateTimer ) where import Model.Timer (..) import Model.Id (..) type TimerAction = Restart | ToggleRunning | Stop updateTimer : TimerAction -> Timer -> Timer updateTimer action timer = case action of ToggleRunning -> { timer | isRunning <- timer.currentTime > 0.0 && not timer.isRunning } Restart -> { timer | isRunning <- True , currentTime <- initTime timer.initialTime } Stop -> { timer | isRunning <- False , currentTime <- initTime timer.initialTime }