-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Time utilities
--
-- Please see the README on GitHub at
-- https://github.com/jlamothe/timeutils#readme
@package timeutils
@version 0.1.0
-- | timeutils
--
-- Copyright (C) 2019 Jonathan Lamothe jlamothe1980@gmail.com
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or (at
-- your option) any later version.
--
-- This program is distributed in the hope that it will be useful, but
-- WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see
-- https://www.gnu.org/licenses/.
module Data.Time.Utils
-- | A type that keeps track of the passage of time
data Timer
Timer :: NominalDiffTime -> Maybe UTCTime -> Timer
-- | The amount of time previously logged
[timerOffset] :: Timer -> NominalDiffTime
-- | The time the Timer was last started (Nothing if not
-- currently running)
[timerStartTime] :: Timer -> Maybe UTCTime
-- | Represents a NominalDiffTime broken down into days, hours,
-- minutes, seconds and milliseconds
data TimeParts
TimeParts :: Int -> Int -> Int -> Int -> Int -> TimeParts
-- | The number of days
[tpDays] :: TimeParts -> Int
-- | The number of hours
[tpHours] :: TimeParts -> Int
-- | The number of minutes
[tpMinutes] :: TimeParts -> Int
-- | The number of seconds
[tpSeconds] :: TimeParts -> Int
-- | The number of milliseconds
[tpMillis] :: TimeParts -> Int
-- | Represents a timed countdown
data Countdown
Countdown :: NominalDiffTime -> Timer -> Countdown
-- | The length of time
[countdownLength] :: Countdown -> NominalDiffTime
-- | The timer which runs the Countdown
[countdownTimer] :: Countdown -> Timer
-- | Tracks the time of multiple laps
data Stopwatch
Stopwatch :: Timer -> [NominalDiffTime] -> Stopwatch
-- | The Timer for the current lap
[stopwatchTimer] :: Stopwatch -> Timer
-- | The times of previous laps (most recent first)
[stopwatchLaps] :: Stopwatch -> [NominalDiffTime]
-- | Lens for the timerOffset attribute
timerOffsetL :: Lens' Timer NominalDiffTime
-- | Lens for the timerStartTime attribute
timerStartTimeL :: Lens' Timer (Maybe UTCTime)
-- | Lens for the tpDays attribute
tpDaysL :: Lens' TimeParts Int
-- | Lens for the tpHours attribute
tpHoursL :: Lens' TimeParts Int
-- | Lens for the tpMinutes attribute
tpMinutesL :: Lens' TimeParts Int
-- | Lens for the tpSeconds attribute
tpSecondsL :: Lens' TimeParts Int
-- | Lens for the tpMillis attribute
tpMillisL :: Lens' TimeParts Int
-- | Lens for the countdownLength attribute
countdownLengthL :: Lens' Countdown NominalDiffTime
-- | Lens for the countdownTimer attribute
countdownTimerL :: Lens' Countdown Timer
-- | Lens for the stopwatchTimer attribute
stopwatchTimerL :: Lens' Stopwatch Timer
-- | Lens for the stopwatchLaps attribute
stopwatchLapsL :: Lens' Stopwatch [NominalDiffTime]
-- | New instance of a Timer
newTimer :: Timer
-- | New instance of a TimeParts value
newTimeParts :: TimeParts
-- | New instance of a Countdown
newCountdown :: NominalDiffTime -> Countdown
-- | New instance of a stopwatch
newStopwatch :: Stopwatch
-- | Starts a Timer
startTimer :: Timer -> IO Timer
-- | Stops a Timer
stopTimer :: Timer -> IO Timer
-- | Calculates the amount of time elapsed on a Timer
timeElapsed :: Timer -> IO NominalDiffTime
-- | Starts a Countdown
startCountdown :: Countdown -> IO Countdown
-- | Stops a Countdown
stopCountdown :: Countdown -> IO Countdown
-- | Calculates the amount of time remaining in a Countdown
timeRemaining :: Countdown -> IO NominalDiffTime
-- | Determines whether or not a Countdown has completed.
countdownIsCompleted :: Countdown -> IO Bool
-- | Starts a Stopwatch
startStopwatch :: Stopwatch -> IO Stopwatch
-- | Stops a Stopwatch
stopStopwatch :: Stopwatch -> IO Stopwatch
-- | Starts a new lap
newLap :: Stopwatch -> IO Stopwatch
-- | Returns the time of the current lap from a Stopwatch
currentLap :: Stopwatch -> IO NominalDiffTime
-- | Returns the lap times for a Stopwatch
allLaps :: Stopwatch -> IO [NominalDiffTime]
-- | Calculates the total run time of a Stopwatch
totalStopwatchTime :: Stopwatch -> IO NominalDiffTime
-- | Converts a NominalDiffTime to a TimeParts value
decomposeNDT :: NominalDiffTime -> TimeParts
-- | Converts a TimeParts value to a NominalDiffTime
composeNDT :: TimeParts -> NominalDiffTime
-- | Converts a NominalDiffTime into a more human-readable format
humanNDT :: NominalDiffTime -> String
-- | Determines whether or not a Timer is running
timerIsRunning :: Timer -> Bool
-- | Determines whether or not a Timer has been started (even if it
-- is currently stopped)
timerIsStarted :: Timer -> Bool
-- | Starts a Timer from a given time
startTimerAt :: UTCTime -> Timer -> Timer
-- | Stops a Timer from a given time
stopTimerAt :: UTCTime -> Timer -> Timer
-- | Calculates the amount of time elapsed on a Timer from a given
-- time
timeElapsedAt :: UTCTime -> Timer -> NominalDiffTime
-- | Determines whether or not a Countdown is running
countdownIsRunning :: Countdown -> Bool
-- | Determines whether or not a Countdown has been started (even if
-- subsequently stopped)
countdownIsStarted :: Countdown -> Bool
-- | Starts a Countdown using a given time
startCountdownAt :: UTCTime -> Countdown -> Countdown
-- | Stops a Countdown using a given time
stopCountdownAt :: UTCTime -> Countdown -> Countdown
-- | Calculates the amount of time remaining in a Countdown at a
-- given time
timeRemainingAt :: UTCTime -> Countdown -> NominalDiffTime
-- | Determines if a Countdown is completed at a given time
countdownIsCompletedAt :: UTCTime -> Countdown -> Bool
-- | Determines whether or not a Stopwatch is running
stopwatchIsRunning :: Stopwatch -> Bool
-- | Determines whether or not a stopwatch has been started (even if
-- subsequently stopped)
stopwatchIsStarted :: Stopwatch -> Bool
-- | Starts a Stopwatch at a given time
startStopwatchAt :: UTCTime -> Stopwatch -> Stopwatch
-- | Stops a Stopwatch at a given time
stopStopwatchAt :: UTCTime -> Stopwatch -> Stopwatch
-- | Starts a new lap at a given time
newLapAt :: UTCTime -> Stopwatch -> Stopwatch
-- | Determines the length of the current lap given a time
currentLapAt :: UTCTime -> Stopwatch -> NominalDiffTime
-- | Returns the lap times from a Stopwatch given a time
allLapsAt :: UTCTime -> Stopwatch -> [NominalDiffTime]
-- | Calculates the total runtime of a Stopwatch given a time
totalStopwatchTimeAt :: UTCTime -> Stopwatch -> NominalDiffTime
instance GHC.Show.Show Data.Time.Utils.Stopwatch
instance GHC.Classes.Eq Data.Time.Utils.Stopwatch
instance GHC.Show.Show Data.Time.Utils.Countdown
instance GHC.Classes.Eq Data.Time.Utils.Countdown
instance GHC.Show.Show Data.Time.Utils.TimeParts
instance GHC.Classes.Eq Data.Time.Utils.TimeParts
instance GHC.Show.Show Data.Time.Utils.Timer
instance GHC.Classes.Eq Data.Time.Utils.Timer