-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A simple and efficient time library.
--   
--   A key part of the library is the <a>Timeable</a> and <a>Time</a> type
--   classes.
--   
--   Types representing time values that are instances of the classes allow
--   easy conversion between values of one time type and another.
@package time-hourglass
@version 0.3.0


-- | Time-related types.
--   
--   In principle, some units could hold infinite values. In practice,
--   <a>Int64</a> for seconds (about <tt>+/- 9e18</tt>) and <a>Int</a> for
--   years is sufficient.
module Time.Types

-- | Type representing numbers of nanoseconds.
newtype NanoSeconds
NanoSeconds :: Int64 -> NanoSeconds

-- | Type representing numbers of seconds (non-leap or all).
newtype Seconds
Seconds :: Int64 -> Seconds

-- | Type representing numbers of minutes.
newtype Minutes
Minutes :: Int64 -> Minutes

-- | Type representing numbers of hours.
newtype Hours
Hours :: Int64 -> Hours

-- | Type representing months of the Julian or Gregorian year.
data Month
January :: Month
February :: Month
March :: Month
April :: Month
May :: Month
June :: Month
July :: Month
August :: Month
September :: Month
October :: Month
November :: Month
December :: Month

-- | Type representing days of the week. The enumeration starts on Sunday.
data WeekDay
Sunday :: WeekDay
Monday :: WeekDay
Tuesday :: WeekDay
Wednesday :: WeekDay
Thursday :: WeekDay
Friday :: WeekDay
Saturday :: WeekDay

-- | Given a precise amount of seconds yield a corresponding pair of
--   <a>Seconds</a> and <a>NanoSeconds</a> values.
--   
--   If the precise amount of seconds is negative the number of nanoseconds
--   will not be positive. This can be contrasted with a normalised
--   <a>ElapsedP</a> value.
fromRationalSecondsP :: Rational -> (Seconds, NanoSeconds)

-- | Type representing numbers of non-leap seconds elapsed since the Unix
--   epoch (1970-01-01 00:00:00 UTC).
--   
--   Points in time before the Unix epoch are represented by a negative
--   number of seconds.
newtype Elapsed
Elapsed :: Seconds -> Elapsed

-- | Type representing numbers of non-leap seconds and nanoseconds elapsed
--   since the Unix epoch (1970-01-01 00:00:00 UTC).
data ElapsedP

-- | A normalised <a>ElapsedP</a> value has a nanoseconds field that is
--   non-negative and fewer than 1,000,000,000 nanoseconds (being 1
--   second).
ElapsedP :: Elapsed -> NanoSeconds -> ElapsedP

-- | A constructor of an <a>ElapsedP</a> value.
--   
--   The <a>ElapsedP</a> value will be normalised. That is, the nanoseconds
--   field will be non-negative and fewer than 1,000,000,000 nanoseconds
--   (being 1 second).
mkElapsedP :: Seconds -> NanoSeconds -> ElapsedP

-- | Given a precise amount of non-leap seconds elapsed since the Unix
--   epoch, yield the corresponding <a>ElapsedP</a> value.
--   
--   The <a>ElapsedP</a> value will be normalised. That is, the nanoseconds
--   field will be non-negative and fewer than 1,000,000,000 nanoseconds
--   (being 1 second).
fromRationalElapsedP :: Rational -> ElapsedP

-- | Type representing dates in the proleptic Gregorian calendar (the
--   common calendar).
data Date
Date :: Int -> Month -> Int -> Date

-- | Year of the Common Era.
[dateYear] :: Date -> Int

-- | Month of the year.
[dateMonth] :: Date -> Month

-- | Day of the month, between 1 to 31.
[dateDay] :: Date -> Int

-- | Type representing times as hour, minutes, seconds and nanoseconds.
data TimeOfDay
TimeOfDay :: Hours -> Minutes -> Seconds -> NanoSeconds -> TimeOfDay

-- | Hours, between 0 and 23.
[todHour] :: TimeOfDay -> Hours

-- | Minutes, between 0 and 59.
[todMin] :: TimeOfDay -> Minutes

-- | Seconds, between 0 and 59. A leap second is represented by 60.
[todSec] :: TimeOfDay -> Seconds

-- | Nanoseconds, between 0 and 999,999,999.
[todNSec] :: TimeOfDay -> NanoSeconds

-- | Type representing date and time.
data DateTime
DateTime :: Date -> TimeOfDay -> DateTime
[dtDate] :: DateTime -> Date
[dtTime] :: DateTime -> TimeOfDay

-- | Type representing offsets in minutes against UTC to obtain local time
--   from UTC. A positive number represents a location east of where UTC is
--   local time and a negative number represents a location west of where
--   UTC is local time.
--   
--   LocalTime t (-300) -- t represents a time at UTC-5
--   
--   LocalTime t (+480) -- t represents a time at UTC+8
--   
--   Should be between <tt>(-12 * 60)</tt> and <tt>(+14 * 60)</tt>.
--   
--   For example, in timezone AEDT (Australian Eastern Daylight Time)
--   (UTC+11), local time is 15:47. Consequently, UTC time is 04:47 and the
--   timezone offset is <a>TimezoneOffset</a> <tt>660</tt> (in minutes).
newtype TimezoneOffset
TimezoneOffset :: Int -> TimezoneOffset

-- | The number of minutes.
[timezoneOffsetToMinutes] :: TimezoneOffset -> Int

-- | For the given timezone offset, yield the corresponding number of
--   seconds.
timezoneOffsetToSeconds :: TimezoneOffset -> Seconds

-- | The UTC timezone.
--   
--   <pre>
--   timezoneOffsetToMinutes timezone_UTC == 0 -- True
--   </pre>
timezone_UTC :: TimezoneOffset

-- | Type class promising functionality for:
--   
--   <ul>
--   <li>converting a value of the type in question to a number of seconds;
--   and</li>
--   <li>converting a <a>Seconds</a> value to a pair of a value of the type
--   in question and a remaining number of seconds.</li>
--   </ul>
class TimeInterval i

-- | For the given value, yield a corresponding number of seconds (non-leap
--   or all).
toSeconds :: TimeInterval i => i -> Seconds

-- | For the given number of seconds (non-leap or all), yield a pair of the
--   corresponding value of the type in queston and a remaining number of
--   seconds.
fromSeconds :: TimeInterval i => Seconds -> (i, Seconds)
instance GHC.Internal.Enum.Bounded Time.Types.Month
instance GHC.Internal.Enum.Bounded Time.Types.WeekDay
instance GHC.Internal.Data.Data.Data Time.Types.Date
instance GHC.Internal.Data.Data.Data Time.Types.DateTime
instance GHC.Internal.Data.Data.Data Time.Types.Elapsed
instance GHC.Internal.Data.Data.Data Time.Types.ElapsedP
instance GHC.Internal.Data.Data.Data Time.Types.Hours
instance GHC.Internal.Data.Data.Data Time.Types.Minutes
instance GHC.Internal.Data.Data.Data Time.Types.Month
instance GHC.Internal.Data.Data.Data Time.Types.NanoSeconds
instance GHC.Internal.Data.Data.Data Time.Types.Seconds
instance GHC.Internal.Data.Data.Data Time.Types.TimeOfDay
instance GHC.Internal.Data.Data.Data Time.Types.TimezoneOffset
instance GHC.Internal.Data.Data.Data Time.Types.WeekDay
instance GHC.Internal.Enum.Enum Time.Types.Hours
instance GHC.Internal.Enum.Enum Time.Types.Minutes
instance GHC.Internal.Enum.Enum Time.Types.Month
instance GHC.Internal.Enum.Enum Time.Types.Seconds
instance GHC.Internal.Enum.Enum Time.Types.WeekDay
instance GHC.Internal.Classes.Eq Time.Types.Date
instance GHC.Internal.Classes.Eq Time.Types.DateTime
instance GHC.Internal.Classes.Eq Time.Types.Elapsed
instance GHC.Internal.Classes.Eq Time.Types.ElapsedP
instance GHC.Internal.Classes.Eq Time.Types.Hours
instance GHC.Internal.Classes.Eq Time.Types.Minutes
instance GHC.Internal.Classes.Eq Time.Types.Month
instance GHC.Internal.Classes.Eq Time.Types.NanoSeconds
instance GHC.Internal.Classes.Eq Time.Types.Seconds
instance GHC.Internal.Classes.Eq Time.Types.TimeOfDay
instance GHC.Internal.Classes.Eq Time.Types.TimezoneOffset
instance GHC.Internal.Classes.Eq Time.Types.WeekDay
instance GHC.Internal.Real.Integral Time.Types.Hours
instance GHC.Internal.Real.Integral Time.Types.Minutes
instance GHC.Internal.Real.Integral Time.Types.Seconds
instance Control.DeepSeq.NFData Time.Types.Date
instance Control.DeepSeq.NFData Time.Types.DateTime
instance Control.DeepSeq.NFData Time.Types.Elapsed
instance Control.DeepSeq.NFData Time.Types.ElapsedP
instance Control.DeepSeq.NFData Time.Types.Hours
instance Control.DeepSeq.NFData Time.Types.Minutes
instance Control.DeepSeq.NFData Time.Types.NanoSeconds
instance Control.DeepSeq.NFData Time.Types.Seconds
instance Control.DeepSeq.NFData Time.Types.TimeOfDay
instance Control.DeepSeq.NFData Time.Types.TimezoneOffset
instance GHC.Internal.Num.Num Time.Types.Elapsed
instance GHC.Internal.Num.Num Time.Types.ElapsedP
instance GHC.Internal.Num.Num Time.Types.Hours
instance GHC.Internal.Num.Num Time.Types.Minutes
instance GHC.Internal.Num.Num Time.Types.NanoSeconds
instance GHC.Internal.Num.Num Time.Types.Seconds
instance GHC.Internal.Classes.Ord Time.Types.Date
instance GHC.Internal.Classes.Ord Time.Types.DateTime
instance GHC.Internal.Classes.Ord Time.Types.Elapsed
instance GHC.Internal.Classes.Ord Time.Types.ElapsedP
instance GHC.Internal.Classes.Ord Time.Types.Hours
instance GHC.Internal.Classes.Ord Time.Types.Minutes
instance GHC.Internal.Classes.Ord Time.Types.Month
instance GHC.Internal.Classes.Ord Time.Types.NanoSeconds
instance GHC.Internal.Classes.Ord Time.Types.Seconds
instance GHC.Internal.Classes.Ord Time.Types.TimeOfDay
instance GHC.Internal.Classes.Ord Time.Types.TimezoneOffset
instance GHC.Internal.Classes.Ord Time.Types.WeekDay
instance GHC.Internal.Read.Read Time.Types.Date
instance GHC.Internal.Read.Read Time.Types.DateTime
instance GHC.Internal.Read.Read Time.Types.Elapsed
instance GHC.Internal.Read.Read Time.Types.ElapsedP
instance GHC.Internal.Read.Read Time.Types.Hours
instance GHC.Internal.Read.Read Time.Types.Minutes
instance GHC.Internal.Read.Read Time.Types.Month
instance GHC.Internal.Read.Read Time.Types.NanoSeconds
instance GHC.Internal.Read.Read Time.Types.Seconds
instance GHC.Internal.Read.Read Time.Types.TimeOfDay
instance GHC.Internal.Read.Read Time.Types.TimezoneOffset
instance GHC.Internal.Read.Read Time.Types.WeekDay
instance GHC.Internal.Real.Real Time.Types.ElapsedP
instance GHC.Internal.Real.Real Time.Types.Hours
instance GHC.Internal.Real.Real Time.Types.Minutes
instance GHC.Internal.Real.Real Time.Types.Seconds
instance GHC.Internal.Show.Show Time.Types.Date
instance GHC.Internal.Show.Show Time.Types.DateTime
instance GHC.Internal.Show.Show Time.Types.Elapsed
instance GHC.Internal.Show.Show Time.Types.ElapsedP
instance GHC.Internal.Show.Show Time.Types.Hours
instance GHC.Internal.Show.Show Time.Types.Minutes
instance GHC.Internal.Show.Show Time.Types.Month
instance GHC.Internal.Show.Show Time.Types.NanoSeconds
instance GHC.Internal.Show.Show Time.Types.Seconds
instance GHC.Internal.Show.Show Time.Types.TimeOfDay
instance GHC.Internal.Show.Show Time.Types.TimezoneOffset
instance GHC.Internal.Show.Show Time.Types.WeekDay
instance Time.Types.TimeInterval Time.Types.Hours
instance Time.Types.TimeInterval Time.Types.Minutes
instance Time.Types.TimeInterval Time.Types.NanoSeconds
instance Time.Types.TimeInterval Time.Types.Seconds


-- | Types, type classes and functions related to epochs.
module Time.Epoch

-- | A type representing the number of non-leap seconds that have elapsed
--   since the specified epoch.
newtype ElapsedSince epoch
ElapsedSince :: Seconds -> ElapsedSince epoch

-- | A type representing the number of non-leap seconds and nanoseconds
--   that have elapsed since the specified epoch. The 'P' is short for
--   'precise'.
data ElapsedSinceP epoch
ElapsedSinceP :: ElapsedSince epoch -> NanoSeconds -> ElapsedSinceP epoch

-- | A type class promising epoch-related functionality. (Epochs, in this
--   context, are fixed points in time.)
class Epoch epoch

-- | The name of the epoch.
epochName :: Epoch epoch => epoch -> String

-- | The epoch relative to the Unix epoch (1970-01-01 00:00:00 UTC), in
--   non-leap seconds. A negative number means the epoch is before the Unix
--   epoch.
epochDiffToUnix :: Epoch epoch => epoch -> Seconds

-- | A type representing the Unix epoch (the point in time represented by
--   1970-01-01 00:00:00 UTC).
data UnixEpoch
UnixEpoch :: UnixEpoch

-- | A type representing the <a>Windows epoch</a>, (the point in time
--   represented by 1601-01-01 00:00:00 UTC).
data WindowsEpoch
WindowsEpoch :: WindowsEpoch

-- | A type representing the Modified Julian Date (MJD) epoch (the point in
--   time represented by 1858-11-17 00:00:00 UTC).
data MJDEpoch
MJDEpoch :: MJDEpoch
instance GHC.Internal.Data.Data.Data epoch => GHC.Internal.Data.Data.Data (Time.Epoch.ElapsedSince epoch)
instance GHC.Internal.Data.Data.Data epoch => GHC.Internal.Data.Data.Data (Time.Epoch.ElapsedSinceP epoch)
instance Time.Epoch.Epoch Time.Epoch.MJDEpoch
instance Time.Epoch.Epoch Time.Epoch.UnixEpoch
instance Time.Epoch.Epoch Time.Epoch.WindowsEpoch
instance GHC.Internal.Classes.Eq (Time.Epoch.ElapsedSince epoch)
instance GHC.Internal.Classes.Eq (Time.Epoch.ElapsedSinceP epoch)
instance GHC.Internal.Classes.Eq Time.Epoch.MJDEpoch
instance GHC.Internal.Classes.Eq Time.Epoch.UnixEpoch
instance GHC.Internal.Classes.Eq Time.Epoch.WindowsEpoch
instance Control.DeepSeq.NFData (Time.Epoch.ElapsedSince epoch)
instance Control.DeepSeq.NFData (Time.Epoch.ElapsedSinceP e)
instance GHC.Internal.Num.Num (Time.Epoch.ElapsedSince epoch)
instance GHC.Internal.Num.Num (Time.Epoch.ElapsedSinceP e)
instance GHC.Internal.Classes.Ord (Time.Epoch.ElapsedSince epoch)
instance GHC.Internal.Classes.Ord (Time.Epoch.ElapsedSinceP epoch)
instance GHC.Internal.Read.Read (Time.Epoch.ElapsedSince epoch)
instance GHC.Internal.Read.Read (Time.Epoch.ElapsedSinceP epoch)
instance GHC.Internal.Real.Real (Time.Epoch.ElapsedSinceP e)
instance GHC.Internal.Show.Show (Time.Epoch.ElapsedSince epoch)
instance GHC.Internal.Show.Show (Time.Epoch.ElapsedSinceP epoch)
instance GHC.Internal.Show.Show Time.Epoch.MJDEpoch
instance GHC.Internal.Show.Show Time.Epoch.UnixEpoch
instance GHC.Internal.Show.Show Time.Epoch.WindowsEpoch
instance Time.Epoch.Epoch epoch => Time.Time.Time (Time.Epoch.ElapsedSince epoch)
instance Time.Epoch.Epoch epoch => Time.Time.Time (Time.Epoch.ElapsedSinceP epoch)
instance Time.Epoch.Epoch epoch => Time.Time.Timeable (Time.Epoch.ElapsedSince epoch)
instance Time.Epoch.Epoch epoch => Time.Time.Timeable (Time.Epoch.ElapsedSinceP epoch)


-- | Basic time conversion compatibility.
--   
--   This module aims to help conversion between types from <tt>time</tt>
--   package and types from the <tt>time-hourglass</tt> package.
--   
--   An example of use (taken from file
--   examples<i>Example</i>Time/Compat.hs):
--   
--   <pre>
--   import Data.Hourglass as H
--   import Time.Compat as C
--   import Data.Time as T
--   
--   transpose :: T.ZonedTime -&gt; H.LocalTime H.DateTime
--   transpose oldTime = H.localTime
--     offsetTime
--     (H.DateTime newDate timeofday)
--    where
--     T.ZonedTime (T.LocalTime day tod) (T.TimeZone tzmin _ _) = oldTime
--   
--     newDate :: H.Date
--     newDate = C.dateFromMJDEpoch $ T.toModifiedJulianDay day
--   
--     timeofday :: H.TimeOfDay
--     timeofday = C.diffTimeToTimeOfDay $ toRational $ T.timeOfDayToTime tod
--   
--     offsetTime = H.TimezoneOffset $ fromIntegral tzmin
--   </pre>
module Time.Compat

-- | Given an integer which represents the number of days since the Unix
--   epoch (1970-01-01 00:00:00 UTC), yield the corresponding date in the
--   proleptic Gregorian calendar.
dateFromUnixEpoch :: Integer -> Date

-- | Given an integer which represents the number of days since the
--   Modified Julian Date (MJD) epoch (1858-11-17 00:00:00 UTC), yields the
--   corresponding date in the proleptic Gregorian calendar.
--   
--   This function allows a user to convert a <a>Day</a> into <a>Date</a>.
--   
--   <pre>
--   import qualified Data.Time.Calendar as T
--   
--   timeDay :: T.Day
--   
--   dateFromMJDEpoch $ T.toModifiedJulianDay timeDay
--   </pre>
dateFromMJDEpoch :: Integer -> Date

-- | Given a real number representing the number of non-leap seconds since
--   the start of the day, yield a <a>TimeOfDay</a> value (assuming no leap
--   seconds).
--   
--   Example with <a>DiffTime</a> type from package <tt>time</tt>:
--   
--   <pre>
--   import qualified Data.Time.Clock as T
--   
--   difftime :: T.DiffTime
--   
--   diffTimeToTimeOfDay difftime
--   </pre>
--   
--   Example with the <a>TimeOfDay</a> type from package <tt>time</tt>:
--   
--   <pre>
--   import qualified Data.Time.Clock as T
--   
--   timeofday :: T.TimeOfDay
--   
--   diffTimeToTimeOfDay $ T.timeOfDayToTime timeofday
--   </pre>
diffTimeToTimeOfDay :: Real t => t -> TimeOfDay


-- | Get the system timezone and current time value in multiple formats.
module Time.System

-- | Get the current number of non-leap seconds elapsed since the Unix
--   epoch.
timeCurrent :: IO Elapsed

-- | Get the current number of non-leap seconds and nanoseconds since the
--   Unix epoch (1970-01-01 00:00:00 UTC).
timeCurrentP :: IO ElapsedP

-- | Get the current global date.
--   
--   This is equivalent to:
--   
--   <pre>
--   timeGetDateTimeOfDay `fmap` timeCurrentP
--   </pre>
dateCurrent :: IO DateTime

-- | Get the localized date by using <a>timezoneCurrent</a> and
--   <a>dateCurrent</a>.
localDateCurrent :: IO (LocalTime DateTime)

-- | Get the localized date at a specific timezone offset.
localDateCurrentAt :: TimezoneOffset -> IO (LocalTime DateTime)

-- | Get the current timezone offset.
--   
--   This includes daylight saving time when it is in operation.
timezoneCurrent :: IO TimezoneOffset


-- | Time-related types and functions.
--   
--   Basic types for representing points in time are <a>Elapsed</a> and
--   <a>ElapsedP</a>. The 'P' is short for 'precise'. <a>Elapsed</a>
--   represents numbers of non-leap seconds elapsed since the Unix epoch
--   (that is, the point of time represented by 1970-01-01 00:00:00 UTC).
--   <a>ElapsedP</a> represents numbers of non-leap seconds and nanoseconds
--   elapsed since that point in time.
--   
--   Values of other types representing points in time can be converted to
--   and from values of the <a>Elapsed</a> and <a>ElapsedP</a> types. For
--   example:
--   
--   <pre>
--   d = timeGetElapsed (Date 1955 April 18) :: Elapsed
--   timeFromElapsed d :: DateTime
--   </pre>
--   
--   Local time is represented by <a>LocalTime</a> <tt>t</tt>,
--   parameterised by any other type representing time (for example,
--   <a>Elapsed</a>, <a>Date</a> or <a>DateTime</a>). A local time value is
--   augmented by a timezone offset in minutes. For example:
--   
--   <pre>
--   localTime (Date 2014 May 4) 600 -- local time at UTC+10 of 4th May 2014
--   </pre>
module Data.Hourglass

-- | Type representing numbers of nanoseconds.
newtype NanoSeconds
NanoSeconds :: Int64 -> NanoSeconds

-- | Type representing numbers of seconds (non-leap or all).
newtype Seconds
Seconds :: Int64 -> Seconds

-- | Type representing numbers of minutes.
newtype Minutes
Minutes :: Int64 -> Minutes

-- | Type representing numbers of hours.
newtype Hours
Hours :: Int64 -> Hours

-- | Type representing months of the Julian or Gregorian year.
data Month
January :: Month
February :: Month
March :: Month
April :: Month
May :: Month
June :: Month
July :: Month
August :: Month
September :: Month
October :: Month
November :: Month
December :: Month

-- | Type representing days of the week. The enumeration starts on Sunday.
data WeekDay
Sunday :: WeekDay
Monday :: WeekDay
Tuesday :: WeekDay
Wednesday :: WeekDay
Thursday :: WeekDay
Friday :: WeekDay
Saturday :: WeekDay

-- | Given a precise amount of seconds yield a corresponding pair of
--   <a>Seconds</a> and <a>NanoSeconds</a> values.
--   
--   If the precise amount of seconds is negative the number of nanoseconds
--   will not be positive. This can be contrasted with a normalised
--   <a>ElapsedP</a> value.
fromRationalSecondsP :: Rational -> (Seconds, NanoSeconds)

-- | Type representing numbers of non-leap seconds elapsed since the Unix
--   epoch (1970-01-01 00:00:00 UTC).
--   
--   Points in time before the Unix epoch are represented by a negative
--   number of seconds.
newtype Elapsed
Elapsed :: Seconds -> Elapsed

-- | Type representing numbers of non-leap seconds and nanoseconds elapsed
--   since the Unix epoch (1970-01-01 00:00:00 UTC).
data ElapsedP

-- | A normalised <a>ElapsedP</a> value has a nanoseconds field that is
--   non-negative and fewer than 1,000,000,000 nanoseconds (being 1
--   second).
ElapsedP :: Elapsed -> NanoSeconds -> ElapsedP

-- | A constructor of an <a>ElapsedP</a> value.
--   
--   The <a>ElapsedP</a> value will be normalised. That is, the nanoseconds
--   field will be non-negative and fewer than 1,000,000,000 nanoseconds
--   (being 1 second).
mkElapsedP :: Seconds -> NanoSeconds -> ElapsedP

-- | Given a precise amount of non-leap seconds elapsed since the Unix
--   epoch, yield the corresponding <a>ElapsedP</a> value.
--   
--   The <a>ElapsedP</a> value will be normalised. That is, the nanoseconds
--   field will be non-negative and fewer than 1,000,000,000 nanoseconds
--   (being 1 second).
fromRationalElapsedP :: Rational -> ElapsedP

-- | Type representing dates in the proleptic Gregorian calendar (the
--   common calendar).
data Date
Date :: Int -> Month -> Int -> Date

-- | Year of the Common Era.
[dateYear] :: Date -> Int

-- | Month of the year.
[dateMonth] :: Date -> Month

-- | Day of the month, between 1 to 31.
[dateDay] :: Date -> Int

-- | Type representing times as hour, minutes, seconds and nanoseconds.
data TimeOfDay
TimeOfDay :: Hours -> Minutes -> Seconds -> NanoSeconds -> TimeOfDay

-- | Hours, between 0 and 23.
[todHour] :: TimeOfDay -> Hours

-- | Minutes, between 0 and 59.
[todMin] :: TimeOfDay -> Minutes

-- | Seconds, between 0 and 59. A leap second is represented by 60.
[todSec] :: TimeOfDay -> Seconds

-- | Nanoseconds, between 0 and 999,999,999.
[todNSec] :: TimeOfDay -> NanoSeconds

-- | Type representing date and time.
data DateTime
DateTime :: Date -> TimeOfDay -> DateTime
[dtDate] :: DateTime -> Date
[dtTime] :: DateTime -> TimeOfDay

-- | Type representing local times.
data LocalTime t

-- | A type class promising timezone-related functionality.
class Timezone tz

-- | Offset in minutes from UTC. Valid values should be between <tt>-12 *
--   60</tt> and <tt>+14 * 60</tt>.
timezoneOffset :: Timezone tz => tz -> Int

-- | The name of the timezone.
--   
--   The default implementation is an ±HH:MM encoding of the
--   <a>timezoneOffset</a>, with an offset of <tt>0</tt> encoded as
--   <tt>-00:00</tt>.
timezoneName :: Timezone tz => tz -> String

-- | Type representing offsets in minutes against UTC to obtain local time
--   from UTC. A positive number represents a location east of where UTC is
--   local time and a negative number represents a location west of where
--   UTC is local time.
--   
--   LocalTime t (-300) -- t represents a time at UTC-5
--   
--   LocalTime t (+480) -- t represents a time at UTC+8
--   
--   Should be between <tt>(-12 * 60)</tt> and <tt>(+14 * 60)</tt>.
--   
--   For example, in timezone AEDT (Australian Eastern Daylight Time)
--   (UTC+11), local time is 15:47. Consequently, UTC time is 04:47 and the
--   timezone offset is <a>TimezoneOffset</a> <tt>660</tt> (in minutes).
newtype TimezoneOffset
TimezoneOffset :: Int -> TimezoneOffset

-- | The number of minutes.
[timezoneOffsetToMinutes] :: TimezoneOffset -> Int

-- | For the given timezone offset, yield the corresponding number of
--   seconds.
timezoneOffsetToSeconds :: TimezoneOffset -> Seconds

-- | Type representing Universal Time Coordinated (UTC).
data UTC
UTC :: UTC

-- | The UTC timezone.
--   
--   <pre>
--   timezoneOffsetToMinutes timezone_UTC == 0 -- True
--   </pre>
timezone_UTC :: TimezoneOffset

-- | Simple timezone containing the number of minutes difference with UTC.
--   
--   Valid values should be between <tt>-12 * 60</tt> and <tt>+14 *
--   60</tt>.
newtype TimezoneMinutes
TimezoneMinutes :: Int -> TimezoneMinutes

-- | For the given timezone offset and time value (assumed to be the local
--   time), yield the corresponding local time.
localTime :: Time t => TimezoneOffset -> t -> LocalTime t

-- | For the given time value, yield the corresponding <a>LocalTime</a>
--   value assuming that there is no timezone offset.
localTimeFromGlobal :: Time t => t -> LocalTime t

-- | For the given timezone offset and local time, yield the corresponding
--   local time.
localTimeSetTimezone :: Time t => TimezoneOffset -> LocalTime t -> LocalTime t

-- | The local time.
localTimeUnwrap :: LocalTime t -> t

-- | The timezone offset.
localTimeGetTimezone :: LocalTime t -> TimezoneOffset

-- | For the given year in the Gregorian calendar, is it a leap year (366
--   days long)?
isLeapYear :: Int -> Bool

-- | For the given date in the proleptic Gregorian calendar, yield the day
--   of the week it falls on.
getWeekDay :: Date -> WeekDay

-- | For the given date in the proleptic Gregorian calendar, yield the
--   number of days before the date in the same year. For example, there
--   are <tt>0</tt> days before 1st January.
getDayOfTheYear :: Date -> Int

-- | For the given year and month in the proleptic Gregorian calendar,
--   yield the number of days in the month.
daysInMonth :: Int -> Month -> Int

-- | Type represeting periods of time in hours, minutes, seconds (non-leap
--   or all) and nanoseconds. See <a>Period</a> for periods of time in
--   years, months and days.
data Duration
Duration :: Hours -> Minutes -> Seconds -> NanoSeconds -> Duration

-- | Number of hours.
[durationHours] :: Duration -> Hours

-- | Number of minutes.
[durationMinutes] :: Duration -> Minutes

-- | Number of seconds (non-leap or all).
[durationSeconds] :: Duration -> Seconds

-- | Number of nanoseconds.
[durationNs] :: Duration -> NanoSeconds

-- | Type representing periods of time in years, months and days. See
--   <a>Duration</a> for periods of time in hours, minutes, seconds
--   (non-leap or all) and nanoseconds.
data Period
Period :: Int -> Int -> Int -> Period
[periodYears] :: Period -> Int
[periodMonths] :: Period -> Int
[periodDays] :: Period -> Int

-- | Add the given period of time to the given value for a point in time,
--   assuming that the period of time is equated with a number of non-leap
--   seconds.
--   
--   Example:
--   
--   <pre>
--   t1 `timeAdd` mempty { durationHours = 12 }
--   </pre>
--   
--   Example:
--   
--   <pre>
--   &gt;&gt;&gt; startDate = Date 2016 December 31 -- Date of last leap second
--   
--   &gt;&gt;&gt; preLeapSecond = TimeOfDay 23 59 59 0
--   
--   &gt;&gt;&gt; startDateTime = DateTime startDate preLeapSecond
--   
--   &gt;&gt;&gt; oneNonleapSecond = Duration 0 0 1 0 -- Assume non-leap seconds
--   
--   &gt;&gt;&gt; nextDate = Date 2017 January 1
--   
--   &gt;&gt;&gt; firstSecond = TimeOfDay 0 0 0 0
--   
--   &gt;&gt;&gt; endDateTime = DateTime nextDate firstSecond
--   
--   &gt;&gt;&gt; timeAdd startDateTime oneNonleapSecond == endDateTime
--   True
--   </pre>
timeAdd :: (Time t, TimeInterval ti) => t -> ti -> t

-- | For the two given points in time, yields the difference in non-leap
--   seconds between them.
--   
--   Effectively:
--   
--   <pre>
--   t2 `timeDiff` t1 = t2 - t1
--   </pre>
timeDiff :: (Timeable t1, Timeable t2) => t1 -> t2 -> Seconds

-- | For the two given points in time, yields the difference in non-leap
--   seconds and nanoseconds between them.
--   
--   Effectively:
--   
--   <pre>
--   @t2 `timeDiffP` t1 = t2 - t1
--   </pre>
timeDiffP :: (Timeable t1, Timeable t2) => t1 -> t2 -> (Seconds, NanoSeconds)

-- | Add the given period of time to the given date.
dateAddPeriod :: Date -> Period -> Date

-- | A type class promising functionality for converting <a>ElapsedP</a>
--   values and <a>Elapsed</a> values to values of the type in question.
class Timeable t => Time t

-- | Convert from a number of non-leap seconds and nanoseconds elapsed
--   since the Unix epoch (1970-01-01 00:00:00 UTC).
timeFromElapsedP :: Time t => ElapsedP -> t

-- | Convert from a number of non-leap seconds elapsed since the Unix epoch
--   (1970-01-01 00:00:00 UTC).
--   
--   Defaults to <a>timeFromElapsedP</a>.
timeFromElapsed :: Time t => Elapsed -> t

-- | A type class promising functionality for:
--   
--   <ul>
--   <li>converting a value of the type in question to a <a>Elapsed</a>
--   value or a <a>ElapsedP</a> value; and</li>
--   <li>yielding separately a nanoseconds component of the value of the
--   type in question (should yield <tt>0</tt> when the type is less
--   precise than seconds).</li>
--   </ul>
class Timeable t

-- | Convert the given value to the number of non-leap seconds and
--   nanoseconds elapsed since the Unix epoch (1970-01-01 00:00:00 UTC).
timeGetElapsedP :: Timeable t => t -> ElapsedP

-- | Convert the given value to the number of non-leap seconds elapsed
--   since the Unix epoch (1970-01-01 00:00:00 UTC).
--   
--   Defaults to <a>timeGetElapsedP</a>.
timeGetElapsed :: Timeable t => t -> Elapsed

-- | Optionally, for the given value, yield the number of nanoseconds
--   component.
--   
--   If the type in question does not provide sub-second precision, should
--   yield <tt>0</tt>.
--   
--   Defaults to <a>timeGetElapsedP</a>. For efficiency, if the type in
--   question does not provide sub-second precision, it is a good idea to
--   override this method.
timeGetNanoSeconds :: Timeable t => t -> NanoSeconds

-- | Convert from one time representation to another. This will not compile
--   unless the compiler can infer the types.
--   
--   Specialized functions are available for built-in types:
--   
--   <ul>
--   <li><a>timeGetDate</a></li>
--   <li><a>timeGetDateTimeOfDay</a></li>
--   <li><a>timeGetElapsed</a></li>
--   <li><a>timeGetElapsedP</a></li>
--   </ul>
timeConvert :: (Timeable t1, Time t2) => t1 -> t2

-- | For the given value of a point in time, yield the corresponding date
--   (a specialization of <a>timeConvert</a>).
timeGetDate :: Timeable t => t -> Date

-- | For the given value for a point in time, yield the corresponding date
--   and time (a specialization of <a>timeConvert</a>).
timeGetDateTimeOfDay :: Timeable t => t -> DateTime

-- | For the given value for a point in time, yield the corresponding time
--   (a specialization of <a>timeConvert</a>).
timeGetTimeOfDay :: Timeable t => t -> TimeOfDay

-- | For the given local time of one type, yield the corresponding local
--   time of a different type. This will not compile unless the compiler
--   can infer the types of the two local times.
localTimeConvert :: (Time t1, Time t2) => LocalTime t1 -> LocalTime t2

-- | For the given <a>LocalTime</a> value, yield the corresponding global
--   time.
localTimeToGlobal :: Time t => LocalTime t -> t

-- | Type class promising functionality for:
--   
--   <ul>
--   <li>converting a value of the type in question to a number of seconds;
--   and</li>
--   <li>converting a <a>Seconds</a> value to a pair of a value of the type
--   in question and a remaining number of seconds.</li>
--   </ul>
class TimeInterval i

-- | For the given value, yield a corresponding number of seconds (non-leap
--   or all).
toSeconds :: TimeInterval i => i -> Seconds

-- | For the given number of seconds (non-leap or all), yield a pair of the
--   corresponding value of the type in queston and a remaining number of
--   seconds.
fromSeconds :: TimeInterval i => Seconds -> (i, Seconds)

-- | A type class promising the ability to convert values to a
--   <a>TimeFormatString</a>.
--   
--   <a>String</a> is an instance of <a>TimeFormat</a>. Sequences of
--   characters are interpreted as follows (case-sensitive). The longest
--   valid sequence is parsed first:
--   
--   <ul>
--   <li><i><tt>YY</tt></i> <a>Format_Year2</a>. 2-digit years (<tt>70</tt>
--   is 1970, <tt>69</tt> is 2069).</li>
--   <li><i><tt>YYYY</tt></i> <a>Format_Year4</a>. 4-digit years.</li>
--   <li><i><tt>M</tt></i> <a>Format_Month</a>. Months (<tt>1</tt> to
--   <tt>12</tt>).</li>
--   <li><i><tt>MM</tt></i> <a>Format_Month2</a>. Months padded to 2
--   characters (<tt>01</tt> to <tt>12</tt>).</li>
--   <li><i><tt>Mon</tt></i> <a>Format_MonthName_Short</a>. Short name of
--   the month (<tt>Jan</tt>, <tt>Feb</tt>, ..).</li>
--   <li><i><tt>JJJ</tt></i> <a>Format_DayYear3</a>. Day of the year padded
--   to 3 characters (<tt>001</tt> to <tt>365</tt>, <tt>366</tt> for leap
--   years).</li>
--   <li><i><tt>DD</tt></i> <a>Format_Day2</a>. Day of the month padded to
--   2 characters (<tt>01</tt> to <tt>31</tt>).</li>
--   <li><i><tt>H</tt></i> <a>Format_Hour</a>. Hours padded to 2 characters
--   (<tt>00</tt> to <tt>23</tt>).</li>
--   <li><i><tt>MI</tt></i> <a>Format_Minute</a>. Minutes padded to 2
--   characters (<tt>00</tt> to <tt>59</tt>).</li>
--   <li><i><tt>S</tt></i> <a>Format_Second</a>. Seconds padded to 2
--   characters (<tt>00</tt> to <tt>59</tt>, <tt>60</tt> for leap
--   seconds).</li>
--   <li><i><tt>EPOCH</tt></i> <a>Format_UnixSecond</a>. Number of non-leap
--   seconds since the Unix epoch (1970-01-01 00:00:00 UTC).</li>
--   <li><i><tt>ms</tt></i> <a>Format_MilliSecond</a>. The millisecond
--   component only, padded to 3 characters (<tt>000</tt> to <tt>999</tt>).
--   See <tt>us</tt>/<tt>μ</tt> and <tt>ns</tt> for other named sub-second
--   components.</li>
--   <li><i><tt>us</tt></i> <a>Format_MicroSecond</a>. The microseconds
--   component only, padded to 3 characters (<tt>000</tt> to <tt>999</tt>).
--   See <tt>ms</tt> and <tt>ns</tt> for other named sub-second
--   components.</li>
--   <li><i><tt>μ</tt></i> <a>Format_MicroSecond</a>. As above.</li>
--   <li><i><tt>ns</tt></i> <a>Format_NanoSecond</a>. The nanoseconds
--   component only, padded to 3 characters (<tt>000</tt> to <tt>999</tt>).
--   See <tt>ms</tt> and <tt>us</tt>/<tt>μ</tt> for other named sub-second
--   components.</li>
--   <li><i><tt>p&lt;n&gt;</tt></i> <a>Format_Precision</a>
--   <tt>&lt;n&gt;</tt>. Sub-second display with a precision of
--   <tt>&lt;n&gt;</tt> digit(s), where <tt>&lt;n&gt;</tt> is <tt>1</tt> to
--   <tt>9</tt>.</li>
--   <li><i><tt>TZH:M</tt></i> <a>Format_TzHM_Colon</a>. Timezone offset
--   with colon (for example, <tt>02:00</tt>, <tt>+02:00</tt> or
--   <tt>-02:00</tt>).</li>
--   <li><i><tt>TZHM</tt></i> <a>Format_TzHM</a>. Timezone offset without
--   colon (for example, <tt>0200</tt>, <tt>+0200</tt> or
--   <tt>-0200</tt>).</li>
--   <li><i><tt>TZOFS</tt></i> <a>Format_Tz_Offset</a>. Timezone offset in
--   minutes (for example, <tt>120</tt>, <tt>+120</tt> or
--   <tt>-120</tt>).</li>
--   <li><i><tt>&lt;space&gt;</tt></i> <a>Format_Spaces</a>. One or more
--   space-like characters.</li>
--   <li><i><tt>\&lt;character&gt;</tt></i> <a>Format_Text</a>
--   <tt>&lt;character&gt;</tt>. A verbatim character.</li>
--   <li><i><tt>&lt;character&gt;</tt></i> <a>Format_Text</a>
--   <tt>&lt;character&gt;</tt>. A verbatim character.</li>
--   </ul>
--   
--   For example:
--   
--   <pre>
--   &gt;&gt;&gt; let mDateTime = timeParse ("ms \\ms us \\us ns \\ns") "123 ms 456 us 789 ns"
--   
--   &gt;&gt;&gt; timeGetNanoSeconds &lt;$&gt; mDateTime
--   Just 123456789ns
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; timePrint "ms \\ms us \\us ns \\ns" &lt;$&gt; mDateTime
--   Just "123 ms 456 us 789 ns"
--   </pre>
class TimeFormat format
toFormat :: TimeFormat format => format -> TimeFormatString

-- | Type representing time format strings, composed of list of
--   <a>TimeFormatElem</a>.
newtype TimeFormatString
TimeFormatString :: [TimeFormatElem] -> TimeFormatString

-- | Type representing formatters that can be part of a time format string.
data TimeFormatElem

-- | 2-digit years (<tt>70</tt> is 1970, <tt>69</tt> is 2069).
Format_Year2 :: TimeFormatElem

-- | 4-digit years.
Format_Year4 :: TimeFormatElem

-- | Any digits years.
Format_Year :: TimeFormatElem

-- | Months (<tt>1</tt> to <tt>12</tt>).
Format_Month :: TimeFormatElem

-- | Months padded to 2 characters (<tt>01</tt> to <tt>12</tt>).
Format_Month2 :: TimeFormatElem

-- | Short name of the month (<tt>Jan</tt>, <tt>Feb</tt>, ..).
Format_MonthName_Short :: TimeFormatElem

-- | Day of the year (<tt>1</tt> to <tt>365</tt>, <tt>366</tt> for leap
--   years).
Format_DayYear :: TimeFormatElem

-- | Day of the year padded to 3 characters (<tt>001</tt> to <tt>365</tt>,
--   <tt>366</tt> for leap years).
Format_DayYear3 :: TimeFormatElem

-- | Day of the month (<tt>1</tt> to <tt>31</tt>).
Format_Day :: TimeFormatElem

-- | Day of the month padded to 2 characters (<tt>01</tt> to <tt>31</tt>).
Format_Day2 :: TimeFormatElem

-- | Hours padded to 2 characters (<tt>00</tt> to <tt>23</tt>).
Format_Hour :: TimeFormatElem

-- | Minutes padded to 2 characters (<tt>00</tt> to <tt>59</tt>).
Format_Minute :: TimeFormatElem

-- | Seconds padded to 2 characters (<tt>00</tt> to <tt>59</tt>,
--   <tt>60</tt> for leap seconds).
Format_Second :: TimeFormatElem

-- | Number of non-leap seconds since the Unix epoch (1970-01-01 00:00:00
--   UTC).
Format_UnixSecond :: TimeFormatElem

-- | The millisecond component only, padded to 3 characters (<tt>000</tt>
--   to <tt>999</tt>). See <a>Format_MicroSecond</a> and
--   <a>Format_NanoSecond</a> for other named sub-second components.
Format_MilliSecond :: TimeFormatElem

-- | The microseconds component only, padded to 3 characters (<tt>000</tt>
--   to <tt>999</tt>). See <a>Format_MilliSecond</a> and
--   <a>Format_NanoSecond</a> for other named sub-second components.
Format_MicroSecond :: TimeFormatElem

-- | The nanoseconds component only, padded to 3 characters (<tt>000</tt>
--   to <tt>999</tt>). See <a>Format_MilliSecond</a> and
--   <a>Format_MicroSecond</a> for other named sub-second components.
Format_NanoSecond :: TimeFormatElem

-- | Sub-second display with a precision of n digits, with n between
--   <tt>1</tt> and <tt>9</tt>.
Format_Precision :: Int -> TimeFormatElem

-- | Timezone name.
Format_TimezoneName :: TimeFormatElem

-- | Zero UTC offset (<tt>Z</tt>) or timezone offset with colon (for
--   example, <tt>02:00</tt>, <tt>+02:00</tt> or <tt>-02:00</tt>).
Format_TzHM_Colon_Z :: TimeFormatElem

-- | Timezone offset with colon (for example, <tt>02:00</tt>,
--   <tt>+02:00</tt> or <tt>-02:00</tt>).
Format_TzHM_Colon :: TimeFormatElem

-- | Timezone offset without colon (for example, <tt>0200</tt>,
--   <tt>+0200</tt> or <tt>-0200</tt>).
Format_TzHM :: TimeFormatElem

-- | Timezone offset in minutes (for example, <tt>120</tt>, <tt>+120</tt>
--   or <tt>-120</tt>).
Format_Tz_Offset :: TimeFormatElem

-- | One or more space-like characters.
Format_Spaces :: TimeFormatElem

-- | A verbatim character.
Format_Text :: Char -> TimeFormatElem

-- | A custom time format function. See <a>TimeFormatFct</a>.
Format_Fct :: TimeFormatFct -> TimeFormatElem

-- | Type representing format functions.
data TimeFormatFct
TimeFormatFct :: String -> ((DateTime, TimezoneOffset) -> String -> Either String ((DateTime, TimezoneOffset), String)) -> (DateTime -> TimezoneOffset -> String) -> TimeFormatFct

-- | The name of the format function.
[timeFormatFctName] :: TimeFormatFct -> String

-- | A parser of a given <a>String</a>. The first argument is the
--   <tt>(</tt><a>DateTime</a><tt>,</tt> <a>TimezoneOffset</a><tt>)</tt>
--   value before the parser is applied. If the parser fails, the
--   <a>Left</a> value provides an error message. If it succeeds, the
--   <a>Right</a> value provides a pair of a
--   <tt>(</tt><a>DateTime</a><tt>,</tt> <a>TimezoneOffset</a><tt>)</tt>
--   value and any input not consumed by the parser.
[timeFormatParse] :: TimeFormatFct -> (DateTime, TimezoneOffset) -> String -> Either String ((DateTime, TimezoneOffset), String)

-- | A printer of a given <a>DateTime</a> value and <a>TimezoneOffset</a>
--   value.
[timeFormatPrint] :: TimeFormatFct -> DateTime -> TimezoneOffset -> String

-- | A type representing a ISO8601 date format string.
--   
--   e.g. 2014-04-05
data ISO8601_Date
ISO8601_Date :: ISO8601_Date

-- | A type representing a ISO8601 date and time format string.
--   
--   e.g. 2014-04-05T17:25:04+00:00 or 2014-04-05T17:25:04Z.
data ISO8601_DateAndTime
ISO8601_DateAndTime :: ISO8601_DateAndTime

-- | Given the specified format, pretty print the given local time.
--   
--   A <a>Format_TimezoneName</a> will print using the ±HH:MM format, where
--   <tt>0</tt> offset is printed as <tt>-00:00</tt>.
--   
--   A <a>Format_TzHM</a> will print using the ±HHMM format, where
--   <tt>0</tt> offset is printed as <tt>+0000</tt>.
--   
--   A <a>Format_TzHM_Colon</a> will print using the ±HH:MM format, where
--   <tt>0</tt> offset is printed as <tt>+00:00</tt>.
--   
--   A <a>Format_TzHM_Colon_Z</a> will print using the ±HH:MM format, but
--   where <tt>0</tt> offset is printed as <tt>Z</tt>.
--   
--   A <a>Format_Tz_Offset</a> will print non-negative offsets without
--   using an initial <tt>+</tt>.
--   
--   A <a>Format_Spaces</a> will print a single space character.
localTimePrint :: (TimeFormat format, Timeable t) => format -> LocalTime t -> String

-- | Like <a>localTimePrint</a> but the time zone of the time to print will
--   be taken to be UTC.
timePrint :: (TimeFormat format, Timeable t) => format -> t -> String

-- | Given the specified format, try to parse the given string as a
--   <a>LocalTime</a> <a>DateTime</a> value.
--   
--   On failure, yields a <a>Left</a> value with a pair of the current
--   <a>TimeFormatElem</a> value and the reason for the failure.
--   
--   If successful, yields a <a>Right</a> value with a pair of the parsed
--   value and the remaining unparsed string.
--   
--   The default parsed <a>LocalTime</a> <a>DateTime</a> value is 'all
--   zeros'. For example:
--   
--   <pre>
--   &gt;&gt;&gt; let zeroDate = Date 0 January 0
--   
--   &gt;&gt;&gt; let zeroTime = TimeOfDay 0 0 0 0
--   
--   &gt;&gt;&gt; let zeroLocalTime = localTime timezone_UTC (DateTime zeroDate zeroTime)
--   
--   &gt;&gt;&gt; localTimeParseE "" "" == Right (zeroLocalTime, "")
--   True
--   </pre>
--   
--   Later <a>TimeFormatElem</a> values can modify the result of earlier
--   <a>TimeFormatElem</a> values. For example:
--   
--   <pre>
--   &gt;&gt;&gt; let toYear = dateYear . dtDate . localTimeUnwrap . fst
--   
--   &gt;&gt;&gt; toYear &lt;$&gt; (localTimeParseE "YYYY YYYY" "2025 2024")
--   Right 2024
--   </pre>
--   
--   A <a>Format_DayYear</a> or <a>Format_DayYear3</a> value interprets the
--   day of year based on the previously parsed year or, by default, a leap
--   year. For example:
--   
--   <pre>
--   &gt;&gt;&gt; let toMonth = dateMonth . dtDate . localTimeUnwrap . fst
--   
--   &gt;&gt;&gt; let format1 = [Format_Year4, Format_Spaces, Format_DayYear]
--   
--   &gt;&gt;&gt; let format2 = [Format_DayYear, Format_Spaces, Format_Year4]
--   
--   &gt;&gt;&gt; toMonth &lt;$&gt; (localTimeParseE format1 "2025 60")
--   Right March
--   
--   &gt;&gt;&gt; toMonth &lt;$&gt; (localTimeParseE format2 "60 2025")
--   Right February
--   </pre>
--   
--   A <a>Format_TimezoneName</a> will parse one or more non-white space
--   characters but will not modify the previously parsed, or default, date
--   and time.
--   
--   A <a>Format_Month</a>, <a>Format_DayYear</a>, <a>Format_DayYear3</a>,
--   <a>Format_Day</a> and <a>Format_Tz_Offset</a> will check that the
--   parsed number is within bounds. However, <a>localTimeParseE</a> does
--   not check that any resulting date or time is a valid one.
localTimeParseE :: TimeFormat format => format -> String -> Either (TimeFormatElem, String) (LocalTime DateTime, String)

-- | Like <a>localTimeParseE</a>, but with simpler handing of failure. Does
--   not yield the remaining unparsed string on success.
--   
--   On failure, returns <a>Nothing</a>. If successful, yields <a>Just</a>
--   the parsed value.
localTimeParse :: TimeFormat format => format -> String -> Maybe (LocalTime DateTime)

-- | Like <a>localTimeParseE</a> but the time value is automatically
--   converted to global time.
timeParseE :: TimeFormat format => format -> String -> Either (TimeFormatElem, String) (DateTime, String)

-- | Like <a>localTimeParse</a> but the time value is automatically
--   converted to global time.
timeParse :: TimeFormat format => format -> String -> Maybe DateTime
