HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulechronos-1.1.6.1Haskell2010

Chronos.Types

Data types for representing different date and time-related information.

Internally, the types Int and Int64 are used to represent everything. These are used even when negative values are not appropriate and even if a smaller fixed-size integer could hold the information. The only cases when Int64 is used are when it is neccessary to represent values with numbers 2^29 or higher. These are typically fields that represent nanoseconds.

Unlike the types in the venerable time library, the types here do not allow the user to work with all dates. Since this library uses fixed-precision integral values instead of Integer, all of the usual problems with overflow should be considered. Notably, PosixTime and TaiTime can only be used to represent time between the years 1680 and 2260. All other types in this library correctly represent time a million years before or after 1970.

The vector unbox instances store data in a reasonably compact manner. For example, the instance for Day has three unboxed vectors: Int for the year, Int8 for the month, and Int8 for the day. This only causes corruption of data if the user is trying to use out-of-bounds values for the month and the day. Users are advised to not use the data types provided here to model non-existent times.

  • 25 types
  • Packagechronos-1.1.6.1
  • Exports25
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceTypes.hs
newtypenewtype Day
#

A day represented as the modified Julian date, the number of days since midnight on November 17, 1858.

Constructors

Instances12Enum, Eq, Ord, Read, Show, Storable, …
  • Enum DayDefined in chronos-1.1.6.1 · Chronos
  • Eq DayDefined in chronos-1.1.6.1 · Chronos
  • Ord DayDefined in chronos-1.1.6.1 · Chronos
  • Read DayDefined in chronos-1.1.6.1 · Chronos
  • Show DayDefined in chronos-1.1.6.1 · Chronos
  • Storable DayDefined in chronos-1.1.6.1 · Chronos
  • NFData DayDefined in chronos-1.1.6.1 · Chronos
  • Hashable DayDefined in chronos-1.1.6.1 · Chronos
  • Prim DayDefined in chronos-1.1.6.1 · Chronos
  • FromJSON DayDefined in chronos-1.1.6.1 · Chronos
  • ToJSON DayDefined in chronos-1.1.6.1 · Chronos
  • Torsor Day IntDefined in chronos-1.1.6.1 · Chronos
newtypenewtype DayOfMonth
#

The day of the month.

Instances12Enum, Eq, Ord, Read, Show, NFData, …
newtypenewtype Month
#

The month of the year.

Constructors

Instances13Bounded, Enum, Eq, Ord, Read, Show, …
newtypenewtype Year
#

The number of years elapsed since the beginning of the Common Era.

Constructors

Instances5Eq, Ord, Read, Show, NFData
  • Eq YearDefined in chronos-1.1.6.1 · Chronos
  • Ord YearDefined in chronos-1.1.6.1 · Chronos
  • Read YearDefined in chronos-1.1.6.1 · Chronos
  • Show YearDefined in chronos-1.1.6.1 · Chronos
  • NFData YearDefined in chronos-1.1.6.1 · Chronos
newtypenewtype Offset
#

A UTC offset in minutes.

Constructors

Instances11Enum, Eq, Ord, Read, Show, NFData, …
newtypenewtype Time
#

POSIX time with nanosecond resolution.

Constructors

Instances12Bounded, Eq, Ord, Read, Show, Storable, …
newtypenewtype Timespan
#

A timespan. This is represented internally as a number of nanoseconds.

Constructors

Instances12Eq, Ord, Read, Show, Semigroup, Monoid, …
datadata SubsecondPrecision
#

The precision used when encoding seconds to a human-readable format.

Constructors

Instances5Eq, Ord, Read, Show, NFData
datadata Date
#

A date as represented by the Gregorian calendar.

Instances7Enum, Eq, Ord, Read, Show, NFData, …
  • Enum DateDefined in chronos-1.1.6.1 · Chronos
  • Eq DateDefined in chronos-1.1.6.1 · Chronos
  • Ord DateDefined in chronos-1.1.6.1 · Chronos
  • Read DateDefined in chronos-1.1.6.1 · Chronos
  • Show DateDefined in chronos-1.1.6.1 · Chronos
  • NFData DateDefined in chronos-1.1.6.1 · Chronos
  • Torsor Date IntDefined in chronos-1.1.6.1 · Chronos
datadata OrdinalDate
#

An OrdinalDate is a Year and the number of days elapsed since the Year began.

Instances7Enum, Eq, Ord, Read, Show, NFData, …
datadata Datetime
#

A Date as represented by the Gregorian calendar and a TimeOfDay. While the ToJSON instance encodes with a hyphen separator, the FromJSON instance allows any non-digit character to act as separator, using the lenient parser.

Instances7Eq, Ord, Read, Show, NFData, FromJSON, …
datadata DatetimeFormat
#

The format of a Datetime. In particular this provides separators for parts of the Datetime and nothing else.

Constructors

Instances5Eq, Ord, Read, Show, NFData
datadata OffsetFormat
#

Formatting settings for a timezone offset.

Constructors

Instances9Bounded, Enum, Eq, Ord, Read, Show, …
datadata DatetimeLocale a
#

Locale-specific formatting for weekdays and months. The type variable will likely be instantiated to Text or ByteString.

Constructors

Instances1NFData
datadata MeridiemLocale a
#

Locale-specific formatting for AM and PM.

Instances5Eq, Ord, Read, Show, NFData
datadata TimeInterval
#

A TimeInterval represents a start and end time. It can sometimes be more ergonomic than the Torsor API when you only care about whether or not a Time is within a certain range.

To construct a TimeInterval, it is best to use timeIntervalBuilder, which maintains the invariant that lowerBound interval <= upperBound interval (all functions that act on TimeIntervals assume this invariant).

Constructors

Instances6Bounded, Eq, Ord, Read, Show, NFData
datadata TimeParts
#

Holds all of the parts encoded by a Time. Can be used for formatting if what is presently in the API does not suffice.

Constructors

Instances4Eq, Read, Show, NFData