Safe Haskell | None |
---|
Basic definitions, including type classes, datatypes and functions.
- class Date d where
- fromDateStruct :: DateStruct -> d
- toDateStruct :: d -> DateStruct
- class Date dt => DateTime dt where
- fromDateTimeStruct :: DateTimeStruct -> dt
- toDateTimeStruct :: dt -> DateTimeStruct
- class DateZone dz where
- fromDateZoneStruct :: DateZoneStruct -> dz
- toDateZoneStruct :: dz -> DateZoneStruct
- class DateZone dtz => DateTimeZone dtz where
- fromDateTimeZoneStruct :: DateTimeZoneStruct -> dtz
- toDateTimeZoneStruct :: dtz -> DateTimeZoneStruct
- class DateTimeMath x c where
- plus :: x -> c -> x
- class Duration x c where
- duration :: x -> x -> c
- class Zone x where
- data DateStruct = DateStruct {}
- data DateTimeStruct = DateTimeStruct {}
- data DateZoneStruct = DateZoneStruct {}
- data DateTimeZoneStruct = DateTimeZoneStruct {}
- newtype Year = Year {}
- data Month
- newtype Day = Day {}
- data DayOfWeek
- newtype Hour = Hour {}
- newtype Minute = Minute {}
- newtype Second = Second {}
- newtype Millis = Millis {}
- newtype Micros = Micros {}
- newtype Nanos = Nanos {}
- newtype Picos = Picos {}
- properFracMillis :: Floating a => RealFrac a => a -> (Second, Millis)
- properFracMicros :: Floating a => RealFrac a => a -> (Second, Micros)
- properFracNanos :: Floating a => RealFrac a => a -> (Second, Nanos)
- properFracPicos :: Floating a => RealFrac a => a -> (Second, Picos)
- epochToDate :: Year -> Month -> Day -> Day
- epochToTime :: Year -> Month -> Day -> Hour -> Minute -> Second -> Second
- isLeapYear :: Year -> Bool
- showPeriod :: Hour -> String
- showSuffix :: Day -> String
Classes
fromDateStruct :: DateStruct -> dSource
Compose a timestamp from date components.
toDateStruct :: d -> DateStructSource
Decompose a timestamp into date components.
class Date dt => DateTime dt whereSource
fromDateTimeStruct :: DateTimeStruct -> dtSource
Compose a timestamp from date and time components.
toDateTimeStruct :: dt -> DateTimeStructSource
Decompose a timestamp into date and time components.
fromDateZoneStruct :: DateZoneStruct -> dzSource
Compose a timestamp from date and time zone components.
toDateZoneStruct :: dz -> DateZoneStructSource
Decompose a timestamp into date and time zone components.
class DateZone dtz => DateTimeZone dtz whereSource
fromDateTimeZoneStruct :: DateTimeZoneStruct -> dtzSource
Compose a timestamp from date, time and time zone components.
toDateTimeZoneStruct :: dtz -> DateTimeZoneStructSource
Decompose a timestamp into date, time and time zone components.
class DateTimeMath x c whereSource
class Duration x c whereSource
Structs
data DateStruct Source
A struct with date components.
Components
Year.
Month.
Day.
Day of week.
Hour.
Minute.
Second.
Millisecond.
Microsecond.
Nanosecond.
Picosecond.
Fractions
properFracMillis :: Floating a => RealFrac a => a -> (Second, Millis)Source
Decompose a floating point number into second and millisecond components.
properFracMicros :: Floating a => RealFrac a => a -> (Second, Micros)Source
Decompose a floating point number into second and microsecond components.
properFracNanos :: Floating a => RealFrac a => a -> (Second, Nanos)Source
Decompose a floating point number into second and nanosecond components.
properFracPicos :: Floating a => RealFrac a => a -> (Second, Picos)Source
Decompose a floating point number into second and picosecond components.
Durations
epochToDate :: Year -> Month -> Day -> DaySource
Calculate the number of days that have elapsed between Unix epoch and the given date.
epochToTime :: Year -> Month -> Day -> Hour -> Minute -> Second -> SecondSource
Calculate the number of seconds (excluding leap seconds) that have elapsed between Unix epoch and the given time.
Utilities
isLeapYear :: Year -> BoolSource
Check if the given year is a leap year.
showPeriod :: Hour -> StringSource
Show the pariod (ante or post meridiem) of the given hour.
showSuffix :: Day -> StringSource
Show the suffix of the given day of the month.