HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Modulethyme-0.4.1Haskell2010

Data.Thyme.Calendar.MonthDay

Calendar months and day-of-months.

Synopsis
  • Packagethyme-0.4.1
  • Exports11
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceMonthDay.hs
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