Safe Haskell | None |
---|
Basic definitions, including type classes, datatypes and functions.
- class Date d where
- fromDateStruct :: DateStruct -> d
- toDateStruct :: d -> DateStruct
- class Time t where
- fromTimeStruct :: TimeStruct -> t
- toTimeStruct :: t -> TimeStruct
- class Zone x where
- toTimeZone :: x -> TimeZone -> x
- class (Date dt, Time dt) => DateTime dt where
- fromDateTimeStruct :: DateTimeStruct -> dt
- toDateTimeStruct :: dt -> DateTimeStruct
- class Zone dz => DateZone dz where
- fromDateZoneStruct :: DateZoneStruct -> dz
- toDateZoneStruct :: dz -> DateZoneStruct
- class Zone tz => TimeZone tz where
- fromTimeZoneStruct :: TimeZoneStruct -> tz
- toTimeZoneStruct :: tz -> TimeZoneStruct
- 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
- data DateStruct = DateStruct {}
- data TimeStruct = TimeStruct {}
- 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
- midnightToTime :: 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.
fromTimeStruct :: TimeStruct -> tSource
Compose a timestamp from time components.
toTimeStruct :: t -> TimeStructSource
Decompose a timestamp into time components.
toTimeZone :: x -> TimeZone -> xSource
Change the time zone of a timestamp.
class (Date dt, Time 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.
class Zone dz => DateZone dz whereSource
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 Zone tz => TimeZone tz whereSource
fromTimeZoneStruct :: TimeZoneStruct -> tzSource
Compose a timestamp from time and time zone components.
toTimeZoneStruct :: tz -> TimeZoneStructSource
Decompose a timestamp into time 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.
data TimeStruct Source
A struct with time 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.
midnightToTime :: Hour -> Minute -> Second -> SecondSource
Calculate the number of seconds (excluding leap seconds) that have elapsed between midnight 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.