chronos-0.2.0: A time library, encoding, decoding, and instances

Safe HaskellNone
LanguageHaskell2010

Chronos.Types

Description

Data types for representing different date and time-related information.

Internally, the types Int and Int64 are used to represent everything. These are used even when negative values are not appropriate and even if a smaller fixed-size integer could hold the information. The only cases when Int64 is used are when it is neccessary to represent values with numbers 2^29 or higher. These are typically fields that represent nanoseconds.

Unlike the types in the venerable time library, the types here do not allow the user to work with all dates. Since this library uses fixed-precision integral values instead of Integer, all of the usual problems with overflow should be considered. Notably, PosixTime and TaiTime can only be used to represent time between the years 1680 and 2260. All other types in this library correctly represent time a million years before or after 1970.

The vector unbox instances, not yet available, will store data in a reasonably compact manner. For example, the instance for Day has three unboxed vectors: Int for the year, Int8 for the month, and Int8 for the day. This only causes corruption of data if the user is trying to use out-of-bounds values for the month and the day. Users are advised to not use the data types provided here to model non-existent times.

Synopsis

Documentation

newtype Day Source #

Constructors

Day 

Fields

Instances

Eq Day Source # 

Methods

(==) :: Day -> Day -> Bool #

(/=) :: Day -> Day -> Bool #

Ord Day Source # 

Methods

compare :: Day -> Day -> Ordering #

(<) :: Day -> Day -> Bool #

(<=) :: Day -> Day -> Bool #

(>) :: Day -> Day -> Bool #

(>=) :: Day -> Day -> Bool #

max :: Day -> Day -> Day #

min :: Day -> Day -> Day #

Read Day Source # 
Show Day Source # 

Methods

showsPrec :: Int -> Day -> ShowS #

show :: Day -> String #

showList :: [Day] -> ShowS #

Hashable Day Source # 

Methods

hashWithSalt :: Int -> Day -> Int #

hash :: Day -> Int #

newtype Days Source #

A duration of days

Constructors

Days 

Fields

Instances

newtype DayOfMonth Source #

Constructors

DayOfMonth 

Fields

Instances

Enum DayOfMonth Source # 
Eq DayOfMonth Source # 
Ord DayOfMonth Source # 
Read DayOfMonth Source # 
Show DayOfMonth Source # 
Prim DayOfMonth Source # 
Unbox DayOfMonth Source # 
Vector Vector DayOfMonth Source # 
MVector MVector DayOfMonth Source # 
data Vector DayOfMonth Source # 
data MVector s DayOfMonth Source # 

newtype DayOfYear Source #

Constructors

DayOfYear 

Fields

newtype Month Source #

Constructors

Month 

Fields

Instances

Bounded Month Source # 
Eq Month Source # 

Methods

(==) :: Month -> Month -> Bool #

(/=) :: Month -> Month -> Bool #

Ord Month Source # 

Methods

compare :: Month -> Month -> Ordering #

(<) :: Month -> Month -> Bool #

(<=) :: Month -> Month -> Bool #

(>) :: Month -> Month -> Bool #

(>=) :: Month -> Month -> Bool #

max :: Month -> Month -> Month #

min :: Month -> Month -> Month #

Read Month Source # 
Show Month Source # 

Methods

showsPrec :: Int -> Month -> ShowS #

show :: Month -> String #

showList :: [Month] -> ShowS #

Prim Month Source # 
Unbox Month Source # 
Vector Vector Month Source # 
MVector MVector Month Source # 
data Vector Month Source # 
data MVector s Month Source # 

newtype Year Source #

Constructors

Year 

Fields

Instances

newtype DayOfWeekMatch a Source #

Constructors

DayOfWeekMatch 

newtype MonthMatch a Source #

Constructors

MonthMatch 

Fields

data SubsecondPrecision Source #

Constructors

SubsecondPrecisionAuto

Rounds to second, millisecond, microsecond, or nanosecond

SubsecondPrecisionFixed !Int

Specify number of places after decimal

data Date Source #

A date as represented by the Gregorian calendar.

Constructors

Date 

Instances

data OffsetFormat Source #

Constructors

OffsetFormatColonOff

%z (e.g., -0400)

OffsetFormatColonOn

%:z (e.g., -04:00)

OffsetFormatSecondsPrecision

%::z (e.g., -04:00:00)

OffsetFormatColonAuto

%:::z (e.g., -04, +05:30)

Instances

Bounded OffsetFormat Source # 
Enum OffsetFormat Source # 
Eq OffsetFormat Source # 
Ord OffsetFormat Source # 
Read OffsetFormat Source # 
Show OffsetFormat Source # 
Generic OffsetFormat Source # 

Associated Types

type Rep OffsetFormat :: * -> * #

type Rep OffsetFormat Source # 
type Rep OffsetFormat = D1 (MetaData "OffsetFormat" "Chronos.Types" "chronos-0.2.0-2mmMEOnhV4kB6z2cKvMmB3" False) ((:+:) ((:+:) (C1 (MetaCons "OffsetFormatColonOff" PrefixI False) U1) (C1 (MetaCons "OffsetFormatColonOn" PrefixI False) U1)) ((:+:) (C1 (MetaCons "OffsetFormatSecondsPrecision" PrefixI False) U1) (C1 (MetaCons "OffsetFormatColonAuto" PrefixI False) U1)))

data DatetimeLocale a Source #

Constructors

DatetimeLocale 

Fields