Safe Haskell | None |
---|---|
Language | Haskell2010 |
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 -> d Source
Compose a timestamp from date components.
toDateStruct :: d -> DateStruct Source
Decompose a timestamp into date components.
fromTimeStruct :: TimeStruct -> t Source
Compose a timestamp from time components.
toTimeStruct :: t -> TimeStruct Source
Decompose a timestamp into time components.
toTimeZone :: x -> TimeZone -> x Source
Change the time zone of a timestamp.
class (Date dt, Time dt) => DateTime dt where Source
fromDateTimeStruct :: DateTimeStruct -> dt Source
Compose a timestamp from date and time components.
toDateTimeStruct :: dt -> DateTimeStruct Source
Decompose a timestamp into date and time components.
class Zone dz => DateZone dz where Source
fromDateZoneStruct :: DateZoneStruct -> dz Source
Compose a timestamp from date and time zone components.
toDateZoneStruct :: dz -> DateZoneStruct Source
Decompose a timestamp into date and time zone components.
class Zone tz => TimeZone tz where Source
fromTimeZoneStruct :: TimeZoneStruct -> tz Source
Compose a timestamp from time and time zone components.
toTimeZoneStruct :: tz -> TimeZoneStruct Source
Decompose a timestamp into time and time zone components.
class DateZone dtz => DateTimeZone dtz where Source
fromDateTimeZoneStruct :: DateTimeZoneStruct -> dtz Source
Compose a timestamp from date, time and time zone components.
toDateTimeZoneStruct :: dtz -> DateTimeZoneStruct Source
Decompose a timestamp into date, time and time zone components.
class DateTimeMath x c where Source
class Duration x c where Source
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 -> Day Source
Calculate the number of days that have elapsed between Unix epoch and the given date.
epochToTime :: Year -> Month -> Day -> Hour -> Minute -> Second -> Second Source
Calculate the number of seconds (excluding leap seconds) that have elapsed between Unix epoch and the given time.
midnightToTime :: Hour -> Minute -> Second -> Second Source
Calculate the number of seconds (excluding leap seconds) that have elapsed between midnight and the given time.
Utilities
isLeapYear :: Year -> Bool Source
Check if the given year is a leap year.
showPeriod :: Hour -> String Source
Show the pariod (ante or post meridiem) of the given hour.
showSuffix :: Day -> String Source
Show the suffix of the given day of the month.