HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduletime-compat-1.9.8Haskell2010

Data.Time.Calendar.Compat

  • 6 types
  • 1 class
  • 32 values

Days

3 declarations
newtypenewtype Day
#

The Modified Julian Day is a standard count of days, with zero being the day 1858-11-17.

Instances16Enum, Eq, Data, Ord, Read, Show, …
  • Enum DayDefined in time-1.12.2 · Data.Time.Calendar.Days
  • Eq DayDefined in time-1.12.2 · Data.Time.Calendar.Days
  • Data DayDefined in time-1.12.2 · Data.Time.Calendar.Days
  • Ord DayDefined in time-1.12.2 · Data.Time.Calendar.Days
  • Read DayDefined in time-1.12.2 · Data.Time.Format.Parse · orphan
  • Show DayDefined in time-1.12.2 · Data.Time.Calendar.Gregorian · orphan
  • Ix DayDefined in time-1.12.2 · Data.Time.Calendar.Days
  • Generic DayDefined in time-compat-1.9.8 · Data.Time.Orphans · orphan
  • NFData DayDefined in time-1.12.2 · Data.Time.Calendar.Days
  • Hashable DayDefined in time-compat-1.9.8 · Data.Time.Orphans · orphan
  • DayPeriod DayDefined in time-1.12.2 · Data.Time.Calendar.Days
  • FormatTime DayDefined in time-1.12.2 · Data.Time.Format.Format.Instances · orphan
  • ParseTime DayDefined in time-1.12.2 · Data.Time.Format.Parse.Instances · orphan
  • ISO8601 DayDefined in time-1.12.2 · Data.Time.Format.ISO8601

    yyyy-mm-dd (ISO 8601:2004(E) sec. 4.1.2.2 extended format)

  • Lift DayDefined in time-compat-1.9.8 · Data.Time.Orphans · orphan
  • type Rep Day = D1 ('MetaData "Day" "Data.Time.Calendar.Days" "time-1.12.2-cfd2" 'True) (C1 ('MetaCons "ModifiedJulianDay" 'PrefixI 'True) (S1 ('MetaSel ('Just "toModifiedJulianDay") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer)))Defined in time-compat-1.9.8 · Data.Time.Orphans · orphan

DayPeriod

6 declarations
classclass Ord p => DayPeriod p where
#

The class of types which can be represented as a period of days.

Methods

Instances4DayPeriod
valueperiodFromDay :: DayPeriod p => Day -> (p, Int)
#

Get the period this day is in, with the 1-based day number within the period.

periodFromDay (periodFirstDay p) = (p,1)

CalendarDiffTime

6 declarations
datadata CalendarDiffDays
#
Instances12Eq, Data, Show, Generic, Semigroup, Monoid, …

Year, month and day

17 declarations
typetype Year = Integer
#

Year of Common Era (when positive).

typetype MonthOfYear = Int
#

Month of year, in range 1 (January) to 12 (December).

Gregorian calendar

14 declarations

Add months, with days past the last day of the month clipped to the last day. For instance, 2005-01-30 + 1 month = 2005-02-28.

Add years, matching month and day, with Feb 29th clipped to Feb 28th if necessary. For instance, 2004-02-29 + 2 years = 2006-02-28.

Add years, matching month and day, with Feb 29th rolled over to Mar 1st if necessary. For instance, 2004-02-29 + 2 years = 2006-03-01.

valueisLeapYear :: Year -> Bool
#

Is this year a leap year according to the proleptic Gregorian calendar?

Week

7 declarations
datadata DayOfWeek
#
Instances11Enum, Eq, Data, Ord, Read, Show, …
  • Enum DayOfWeekDefined in time-1.12.2 · Data.Time.Calendar.Week

    "Circular", so for example [Tuesday ..] gives an endless sequence. Also: fromEnum gives [1 .. 7] for [Monday .. Sunday], and toEnum performs mod 7 to give a cycle of days.

  • Eq DayOfWeekDefined in time-1.12.2 · Data.Time.Calendar.Week
  • Data DayOfWeekDefined in time-1.12.2 · Data.Time.Calendar.Week
  • Ord DayOfWeekDefined in time-1.12.2 · Data.Time.Calendar.Week
  • Read DayOfWeekDefined in time-1.12.2 · Data.Time.Calendar.Week
  • Show DayOfWeekDefined in time-1.12.2 · Data.Time.Calendar.Week
  • Ix DayOfWeekDefined in time-1.12.2 · Data.Time.Calendar.Week
  • NFData DayOfWeekDefined in time-1.12.2 · Data.Time.Calendar.Week
  • Hashable DayOfWeekDefined in time-compat-1.9.8 · Data.Time.Orphans · orphan
  • FormatTime DayOfWeekDefined in time-1.12.2 · Data.Time.Format.Format.Instances · orphan
  • Lift DayOfWeekDefined in time-compat-1.9.8 · Data.Time.Orphans · orphan
valueweekAllDays :: DayOfWeek -> Day -> [Day]
#

Returns a week containing the given Day where the first day is the DayOfWeek specified.

Examples:

Example1 expression
weekAllDays Sunday (YearMonthDay 2022 02 21)[YearMonthDay 2022 2 20 .. YearMonthDay 2022 2 26]
Example1 expression
weekAllDays Monday (YearMonthDay 2022 02 21)[YearMonthDay 2022 2 21 .. YearMonthDay 2022 2 27]
Example1 expression
weekAllDays Tuesday (YearMonthDay 2022 02 21)[YearMonthDay 2022 2 15 .. YearMonthDay 2022 2 21]
valueweekFirstDay :: DayOfWeek -> Day -> Day
#

Returns the first day of a week containing the given Day.

Examples:

Example1 expression
weekFirstDay Sunday (YearMonthDay 2022 02 21)YearMonthDay 2022 2 20
Example1 expression
weekFirstDay Monday (YearMonthDay 2022 02 21)YearMonthDay 2022 2 21
Example1 expression
weekFirstDay Tuesday (YearMonthDay 2022 02 21)YearMonthDay 2022 2 15
valueweekLastDay :: DayOfWeek -> Day -> Day
#

Returns the last day of a week containing the given Day.

Examples:

Example1 expression
weekLastDay Sunday (YearMonthDay 2022 02 21)YearMonthDay 2022 2 26
Example1 expression
weekLastDay Monday (YearMonthDay 2022 02 21)YearMonthDay 2022 2 27
Example1 expression
weekLastDay Tuesday (YearMonthDay 2022 02 21)YearMonthDay 2022 2 21

Type aliases

1 declaration
patternpattern YearMonthDay :: Year -> MonthOfYear -> DayOfMonth -> Day
#

Bidirectional abstract constructor for the proleptic Gregorian calendar. Invalid values will be clipped to the correct range, month first, then day.