HORIZON HASKELLDocslts/ghc-9.14.x45dd5372026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11

Moduletime-hourglass-0.3.0Haskell2010

Time.Types

Time-related types.

In principle, some units could hold infinite values. In practice, Int64 for seconds (about +/- 9e18) and Int for years is sufficient.

  • 12 types
  • 1 class
  • 5 values

Time units

4 declarations
newtypenewtype NanoSeconds
#

Type representing numbers of nanoseconds.

Constructors

Instances8Eq, Data, Num, Ord, Read, Show, …
newtypenewtype Seconds
#

Type representing numbers of seconds (non-leap or all).

Constructors

Instances11Enum, Eq, Integral, Data, Num, Ord, …
  • Enum SecondsDefined in time-hourglass-0.3.0 · Time.Types
  • Eq SecondsDefined in time-hourglass-0.3.0 · Time.Types
  • Integral SecondsDefined in time-hourglass-0.3.0 · Time.Types
  • Data SecondsDefined in time-hourglass-0.3.0 · Time.Types
  • Num SecondsDefined in time-hourglass-0.3.0 · Time.Types
  • Ord SecondsDefined in time-hourglass-0.3.0 · Time.Types
  • Read SecondsDefined in time-hourglass-0.3.0 · Time.Types
  • Real SecondsDefined in time-hourglass-0.3.0 · Time.Types
  • Show SecondsDefined in time-hourglass-0.3.0 · Time.Types

    Show the number of seconds followed by s. (Note: the Read instance is derived.)

  • NFData SecondsDefined in time-hourglass-0.3.0 · Time.Types
  • TimeInterval SecondsDefined in time-hourglass-0.3.0 · Time.Types
newtypenewtype Minutes
#

Type representing numbers of minutes.

Constructors

Instances11Enum, Eq, Integral, Data, Num, Ord, …
  • Enum MinutesDefined in time-hourglass-0.3.0 · Time.Types
  • Eq MinutesDefined in time-hourglass-0.3.0 · Time.Types
  • Integral MinutesDefined in time-hourglass-0.3.0 · Time.Types
  • Data MinutesDefined in time-hourglass-0.3.0 · Time.Types
  • Num MinutesDefined in time-hourglass-0.3.0 · Time.Types
  • Ord MinutesDefined in time-hourglass-0.3.0 · Time.Types
  • Read MinutesDefined in time-hourglass-0.3.0 · Time.Types
  • Real MinutesDefined in time-hourglass-0.3.0 · Time.Types
  • Show MinutesDefined in time-hourglass-0.3.0 · Time.Types

    Show the number of minutes followed by m. (Note: the Read instance is derived.)

  • NFData MinutesDefined in time-hourglass-0.3.0 · Time.Types
  • TimeInterval MinutesDefined in time-hourglass-0.3.0 · Time.Types
newtypenewtype Hours
#

Type representing numbers of hours.

Constructors

Instances11Enum, Eq, Integral, Data, Num, Ord, …
  • Enum HoursDefined in time-hourglass-0.3.0 · Time.Types
  • Eq HoursDefined in time-hourglass-0.3.0 · Time.Types
  • Integral HoursDefined in time-hourglass-0.3.0 · Time.Types
  • Data HoursDefined in time-hourglass-0.3.0 · Time.Types
  • Num HoursDefined in time-hourglass-0.3.0 · Time.Types
  • Ord HoursDefined in time-hourglass-0.3.0 · Time.Types
  • Read HoursDefined in time-hourglass-0.3.0 · Time.Types
  • Real HoursDefined in time-hourglass-0.3.0 · Time.Types
  • Show HoursDefined in time-hourglass-0.3.0 · Time.Types

    Show the number of hours followed by h. (Note: the Read instance is derived.)

  • NFData HoursDefined in time-hourglass-0.3.0 · Time.Types
  • TimeInterval HoursDefined in time-hourglass-0.3.0 · Time.Types

Calendar enumerations

2 declarations
datadata Month
#

Type representing months of the Julian or Gregorian year.

Instances7Bounded, Enum, Eq, Data, Ord, Read, …
  • Bounded MonthDefined in time-hourglass-0.3.0 · Time.Types
  • Enum MonthDefined in time-hourglass-0.3.0 · Time.Types
  • Eq MonthDefined in time-hourglass-0.3.0 · Time.Types
  • Data MonthDefined in time-hourglass-0.3.0 · Time.Types
  • Ord MonthDefined in time-hourglass-0.3.0 · Time.Types
  • Read MonthDefined in time-hourglass-0.3.0 · Time.Types
  • Show MonthDefined in time-hourglass-0.3.0 · Time.Types
datadata WeekDay
#

Type representing days of the week. The enumeration starts on Sunday.

Instances7Bounded, Enum, Eq, Data, Ord, Read, …
  • Bounded WeekDayDefined in time-hourglass-0.3.0 · Time.Types
  • Enum WeekDayDefined in time-hourglass-0.3.0 · Time.Types
  • Eq WeekDayDefined in time-hourglass-0.3.0 · Time.Types
  • Data WeekDayDefined in time-hourglass-0.3.0 · Time.Types
  • Ord WeekDayDefined in time-hourglass-0.3.0 · Time.Types
  • Read WeekDayDefined in time-hourglass-0.3.0 · Time.Types
  • Show WeekDayDefined in time-hourglass-0.3.0 · Time.Types

Points in time

0 declarations

Precise amounts of seconds

Elapsed time since the Unix epoch

newtypenewtype Elapsed
#

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.

Constructors

Instances9Eq, Data, Num, Ord, Read, Show, …
  • Eq ElapsedDefined in time-hourglass-0.3.0 · Time.Types
  • Data ElapsedDefined in time-hourglass-0.3.0 · Time.Types
  • Num ElapsedDefined in time-hourglass-0.3.0 · Time.Types
  • Ord ElapsedDefined in time-hourglass-0.3.0 · Time.Types
  • Read ElapsedDefined in time-hourglass-0.3.0 · Time.Types
  • Show ElapsedDefined in time-hourglass-0.3.0 · Time.Types

    Show the number of seconds followed by s. (Note: the Read instance is derived.)

  • NFData ElapsedDefined in time-hourglass-0.3.0 · Time.Types
  • Time ElapsedDefined in time-hourglass-0.3.0 · Time.Time
  • Timeable ElapsedDefined in time-hourglass-0.3.0 · Time.Time
datadata ElapsedP
#

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

Constructors

Instances10Eq, Data, Num, Ord, Read, Real, …
  • Eq ElapsedPDefined in time-hourglass-0.3.0 · Time.Types
  • Data ElapsedPDefined in time-hourglass-0.3.0 · Time.Types
  • Num ElapsedPDefined in time-hourglass-0.3.0 · Time.Types
  • Ord ElapsedPDefined in time-hourglass-0.3.0 · Time.Types
  • Read ElapsedPDefined in time-hourglass-0.3.0 · Time.Types
  • Real ElapsedPDefined in time-hourglass-0.3.0 · Time.Types
  • Show ElapsedPDefined in time-hourglass-0.3.0 · Time.Types

    Show the number of seconds followed by s, ., and the number of nanoseconds followed by ns. (Note: the Read instance is derived.)

  • NFData ElapsedPDefined in time-hourglass-0.3.0 · Time.Types
  • Time ElapsedPDefined in time-hourglass-0.3.0 · Time.Time
  • Timeable ElapsedPDefined in time-hourglass-0.3.0 · Time.Time

Given a precise amount of non-leap seconds elapsed since the Unix epoch, yield the corresponding ElapsedP value.

The ElapsedP value will be normalised. That is, the nanoseconds field will be non-negative and fewer than 1,000,000,000 nanoseconds (being 1 second).

Date, time, and date and time

datadata Date
#

Type representing dates in the proleptic Gregorian calendar (the common calendar).

Constructors

Instances8Eq, Data, Ord, Read, Show, NFData, …
  • Eq DateDefined in time-hourglass-0.3.0 · Time.Types
  • Data DateDefined in time-hourglass-0.3.0 · Time.Types
  • Ord DateDefined in time-hourglass-0.3.0 · Time.Types
  • Read DateDefined in time-hourglass-0.3.0 · Time.Types
  • Show DateDefined in time-hourglass-0.3.0 · Time.Types
  • NFData DateDefined in time-hourglass-0.3.0 · Time.Types
  • Time DateDefined in time-hourglass-0.3.0 · Time.Time
  • Timeable DateDefined in time-hourglass-0.3.0 · Time.Time
datadata TimeOfDay
#

Type representing times as hour, minutes, seconds and nanoseconds.

Constructors

Instances6Eq, Data, Ord, Read, Show, NFData
datadata DateTime
#

Type representing date and time.

Instances8Eq, Data, Ord, Read, Show, NFData, …

Local time and timezone-related

newtypenewtype TimezoneOffset
#

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 (-12 * 60) and (+14 * 60).

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 TimezoneOffset 660 (in minutes).

Constructors

Instances6Eq, Data, Ord, Read, Show, NFData

Conversion of periods of time

1 declaration
classclass TimeInterval i where
#

Type class promising functionality for:

  • converting a value of the type in question to a number of seconds; and

  • converting a Seconds value to a pair of a value of the type in question and a remaining number of seconds.

Methods

  • toSeconds :: i -> Seconds

    For the given value, yield a corresponding number of seconds (non-leap or all).

  • fromSeconds :: Seconds -> (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.

Instances5TimeInterval