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