lens-1.2: Lenses, Folds and Traversals

PortabilityLiberalTypeSynonyms
Stabilityprovisional
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellNone

Data.Time.Calendar.Lens

Description

Provides fairly ad hoc overloading to access different notions of a Day.

To convert from a Day:

 myDay^.gregorian.year
 myDay^.julian.year

Synopsis

Documentation

modifiedJulianDay :: Simple Iso Day IntegerSource

Returns the modified Julian Day as a standard count of days, with zero being the day 1858-11-17.

class TraverseDay t whereSource

Provide ad hoc overloading for traversing the modified Julian day

Methods

traverseDay :: Simple Traversal t DaySource

Convert the type to a modified Julian day if possible and traverse it.

Traverses nothing if the date isn't valid.

class HasYear t whereSource

Ad hoc overloading for accessing the year

Methods

year :: Simple Lens t IntegerSource

Get the year of a date

class HasMonth t whereSource

Ad hoc overloading for accessing the month

Methods

month :: Simple Lens t IntSource

Get the month of a date

Instances

class HasWeek t whereSource

Ad hoc overloading for accessing the week (what it is relative to may vary from type to type)

Methods

week :: Simple Lens t IntSource

Get the week of a date

Instances

class HasDay t whereSource

Ad hoc overloading for accessing the day (what it is relative to may vary from type to type)

Methods

day :: Simple Lens t IntSource

Get the day of a date

Instances

data Gregorian Source

Date in the proleptic Gregorian calendar.

Constructors

Gregorian 

Fields

gregorianYear :: !Integer

year

gregorianMonth :: !Int

month (1-12)

gregorianDay :: !Int

day (1-31)

gregorian :: Simple Iso Day GregorianSource

Convert tofrom a valid/ date in the proleptic Gregorian calendar

data JulianYearAndDay Source

Proleptic Julian year and day format.

Constructors

JulianYearAndDay 

Fields

julianYearAndDayYear :: !Integer

year (in the proleptic Julian calendar)

julianYearAndDayDay :: !Int

day of the year, with 1 for Jan 1, and 365 (or 366 in leap years) for Dec 31.

julianYearAndDay :: Simple Iso Day JulianYearAndDaySource

Convert tofrom a valid/ proleptic Julian year and day.

data WeekDate Source

ISO 8601 Week Date format.

The first week of a year is the first week to contain at least four days in the corresponding Gregorian year.

Constructors

WeekDate 

Fields

weekDateYear :: !Integer

year. Note: that Week years are not quite the same as Gregorian years, as the first day of the year is always a Monday.

weekDateWeek :: !Int

week number (1-53)

weekDateDay :: !Int

day of week (1 for Monday to 7 for Sunday).

weekDate :: Simple Iso Day WeekDateSource

Convert to/from a valid WeekDate

data OrdinalDate Source

ISO 8601 Ordinal Date format

Constructors

OrdinalDate 

Fields

ordinalDateYear :: !Integer

year (proleptic Gregorian calendar)

ordinalDateDay :: !Int

day of the year, with 1 for Jan 1, and 365 (or 366 in leap years) for Dec 31.

ordinalDate :: Simple Iso Day OrdinalDateSource

Convert to/from a valid ISO 8601 Ordinal Date format.