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

GHC 10.0.0.20260917 · lts/ghc-10.0.x · fc4e598 · 2026-10-11

Modulethyme-0.4.1Haskell2010

Data.Thyme.Calendar.MonthDay

Calendar months and day-of-months.

  • 3 types
  • 8 values
  • Packagethyme-0.4.1
  • Exports11
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceMonthDay.hs
typetype Month = Int
#

Calendar month. January = 1

typetype DayOfMonth = Int
#

Calendar day-of-month, starting from 1.

datadata MonthDay
#

A strict pair of a Month and a DayOfMonth.

Instances19Bounded, Eq, Data, Ord, Show, Generic, …

Predicated on whether or not it's a leap year, convert between an ordinal DayOfYear and the corresponding Month and DayOfMonth.

> 60 ^. monthDay (isLeapYear 2015)
MonthDay {mdMonth = 3, mdDay = 1}
> 60 ^. monthDay (isLeapYear 2016)
MonthDay {mdMonth = 2, mdDay = 29}
> monthDay (isLeapYear 2016) # MonthDay 2 29
60
> monthDay (isLeapYear 2015) # MonthDay 2 28
59

Note that monthDay is an improper Iso, as the following example shows. To handle this case correctly, use monthDayValid.

> monthDay (isLeapYear 2015) # MonthDay 2 29
59