thyme-0.3.5.5: A faster time library

Safe Haskell | None
Language | Haskell2010

Data.Thyme.Calendar

Contents

- Days
- Gregorian calendar
- Orphan instances

Description

`UTCTime` is not Y294K-compliant, and `Bounded` instances for the various calendar types reflect this fact. That said, the calendar calculations by themselves work perfectly fine for a wider range of dates, subject to the size of `Int` for your platform.

Synopsis

- type Years = Int
- type Months = Int
- type Days = Int
- newtype Day = ModifiedJulianDay {
  - toModifiedJulianDay :: Int
  }
- modifiedJulianDay :: Iso' Day Int
- type Year = Int
- type Month = Int
- type DayOfMonth = Int
- data YearMonthDay = YearMonthDay {
  - ymdYear :: !Year
  - ymdMonth :: !Month
  - ymdDay :: !DayOfMonth
  }
- isLeapYear :: Year -> Bool
- yearMonthDay :: Iso' OrdinalDate YearMonthDay
- gregorian :: Iso' Day YearMonthDay
- gregorianValid :: YearMonthDay -> Maybe Day
- showGregorian :: Day -> String
- gregorianMonthLength :: Year -> Month -> Days
- gregorianMonthsClip :: Months -> YearMonthDay -> YearMonthDay
- gregorianMonthsRollover :: Months -> YearMonthDay -> YearMonthDay
- gregorianYearsClip :: Years -> YearMonthDay -> YearMonthDay
- gregorianYearsRollover :: Years -> YearMonthDay -> YearMonthDay
- _ymdYear :: Lens' YearMonthDay Year
- _ymdMonth :: Lens' YearMonthDay Month
- _ymdDay :: Lens' YearMonthDay DayOfMonth

# Documentation

type Years = Int Source #

type Months = Int Source #

type Days = Int Source #

# Days

newtype Day Source #

The Modified Julian Day is a standard count of days, with zero being the day 1858-11-17.

Constructors

ModifiedJulianDay |

Fields

- toModifiedJulianDay :: Int

#### Instances

Instances details

Bounded Day |
Instance details Defined in Data.Thyme.Calendar Methods minBound :: Day maxBound :: Day
Enum Day Source # |
Instance details Defined in Data.Thyme.Calendar.Internal Methods succ :: Day -> Day pred :: Day -> Day toEnum :: Int -> Day fromEnum :: Day -> Int enumFrom :: Day -> [Day] enumFromThen :: Day -> Day -> [Day] enumFromTo :: Day -> Day -> [Day] enumFromThenTo :: Day -> Day -> Day -> [Day]
Eq Day Source # |
Instance details Defined in Data.Thyme.Calendar.Internal Methods (==) :: Day -> Day -> Bool (/=) :: Day -> Day -> Bool
Data Day Source # |

Instance details

Defined in Data.Thyme.Calendar.Internal

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Day -> c Day

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Day

toConstr :: Day -> Constr

dataTypeOf :: Day -> DataType

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Day)

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Day)

gmapT :: (forall b. Data b => b -> b) -> Day -> Day

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Day -> r

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Day -> r

gmapQ :: (forall d. Data d => d -> u) -> Day -> [u]

gmapQi :: Int -> (forall d. Data d => d -> u) -> Day -> u

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Day -> m Day

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Day -> m Day

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Day -> m Day

Ord Day Source # |
Instance details Defined in Data.Thyme.Calendar.Internal 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 |
Instance details Defined in Data.Thyme.Format Methods readsPrec :: Int -> ReadS Day readList :: ReadS [Day] readPrec :: ReadPrec Day readListPrec :: ReadPrec [Day]
Show Day Source # |
Instance details Defined in Data.Thyme.Calendar.Internal Methods showsPrec :: Int -> Day -> ShowS show :: Day -> String showList :: [Day] -> ShowS
Ix Day Source # |
Instance details Defined in Data.Thyme.Calendar.Internal Methods range :: (Day, Day) -> [Day] index :: (Day, Day) -> Day -> Int unsafeIndex :: (Day, Day) -> Day -> Int inRange :: (Day, Day) -> Day -> Bool rangeSize :: (Day, Day) -> Int unsafeRangeSize :: (Day, Day) -> Int
Generic Day Source # |
Instance details Defined in Data.Thyme.Calendar.Internal Associated Types type Rep Day :: Type -> Type Methods from :: Day -> Rep Day x to :: Rep Day x -> Day
Arbitrary Day Source # |
Instance details Defined in Data.Thyme.Calendar Methods arbitrary :: Gen Day Source # shrink :: Day -> [Day] Source #
CoArbitrary Day Source # |
Instance details Defined in Data.Thyme.Calendar.Internal Methods coarbitrary :: Day -> Gen b -> Gen b Source #
Random Day Source # |
Instance details Defined in Data.Thyme.Calendar Methods randomR :: RandomGen g => (Day, Day) -> g -> (Day, g) Source # random :: RandomGen g => g -> (Day, g) Source # randomRs :: RandomGen g => (Day, Day) -> g -> [Day] Source # randoms :: RandomGen g => g -> [Day] Source # randomRIO :: (Day, Day) -> IO Day Source # randomIO :: IO Day Source #
Unbox Day Source # |
Instance details Defined in Data.Thyme.Calendar.Internal
AffineSpace Day Source # |
Instance details Defined in Data.Thyme.Calendar.Internal Associated Types type Diff Day Source # Methods (.-.) :: Day -> Day -> Diff Day Source # (.+^) :: Day -> Diff Day -> Day Source #
NFData Day Source # |
Instance details Defined in Data.Thyme.Calendar.Internal Methods rnf :: Day -> ()
ParseTime Day Source # |
Instance details Defined in Data.Thyme.Format Methods buildTime :: TimeParse -> Day Source #
FormatTime Day Source # |
Instance details Defined in Data.Thyme.Format Methods showsTime :: TimeLocale -> Day -> (Char -> ShowS) -> Char -> ShowS Source #
Vector Vector Day Source # |

Instance details

Defined in Data.Thyme.Calendar.Internal

Methods

basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) Day -> m (Vector Day) Source #

basicUnsafeThaw :: PrimMonad m => Vector Day -> m (Mutable Vector (PrimState m) Day) Source #

basicLength :: Vector Day -> Int Source #

basicUnsafeSlice :: Int -> Int -> Vector Day -> Vector Day Source #

basicUnsafeIndexM :: Monad m => Vector Day -> Int -> m Day Source #

basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) Day -> Vector Day -> m () Source #

elemseq :: Vector Day -> Day -> b -> b Source #

MVector MVector Day Source # |

Instance details

Defined in Data.Thyme.Calendar.Internal

Methods

basicLength :: MVector s Day -> Int Source #

basicUnsafeSlice :: Int -> Int -> MVector s Day -> MVector s Day Source #

basicOverlaps :: MVector s Day -> MVector s Day -> Bool Source #

basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) Day) Source #

basicInitialize :: PrimMonad m => MVector (PrimState m) Day -> m () Source #

basicUnsafeReplicate :: PrimMonad m => Int -> Day -> m (MVector (PrimState m) Day) Source #

basicUnsafeRead :: PrimMonad m => MVector (PrimState m) Day -> Int -> m Day Source #

basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) Day -> Int -> Day -> m () Source #

basicClear :: PrimMonad m => MVector (PrimState m) Day -> m () Source #

basicSet :: PrimMonad m => MVector (PrimState m) Day -> Day -> m () Source #

basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) Day -> MVector (PrimState m) Day -> m () Source #

basicUnsafeMove :: PrimMonad m => MVector (PrimState m) Day -> MVector (PrimState m) Day -> m () Source #

basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) Day -> Int -> m (MVector (PrimState m) Day) Source #

Thyme Day Day Source # |
Instance details Defined in Data.Thyme.Time.Core Methods thyme :: Iso' Day0 Day Source #
type Rep Day Source # |
Instance details Defined in Data.Thyme.Calendar.Internal type Rep Day = D1 ('MetaData "Day" "Data.Thyme.Calendar.Internal" "thyme-0.3.5.5-8yk8awDjzEHHYSq2xJCwO3" 'True) (C1 ('MetaCons "ModifiedJulianDay" 'PrefixI 'True) (S1 ('MetaSel ('Just "toModifiedJulianDay") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))
newtype Vector Day Source # |
Instance details Defined in Data.Thyme.Calendar.Internal newtype Vector Day = V_Day (Vector Int)
type Diff Day Source # |
Instance details Defined in Data.Thyme.Calendar.Internal type Diff Day = Days
newtype MVector s Day Source # |
Instance details Defined in Data.Thyme.Calendar.Internal newtype MVector s Day = MV_Day (MVector s Int)

modifiedJulianDay :: Iso' Day Int Source #

# Gregorian calendar

type Year = Int Source #

type Month = Int Source #

type DayOfMonth = Int Source #

data YearMonthDay Source #

Constructors

YearMonthDay |

Fields

- ymdYear :: !Year
- ymdMonth :: !Month
- ymdDay :: !DayOfMonth

#### Instances

Instances details

Bounded YearMonthDay |
Instance details Defined in Data.Thyme.Calendar Methods minBound :: YearMonthDay maxBound :: YearMonthDay
Eq YearMonthDay Source # |
Instance details Defined in Data.Thyme.Calendar.Internal Methods (==) :: YearMonthDay -> YearMonthDay -> Bool (/=) :: YearMonthDay -> YearMonthDay -> Bool
Data YearMonthDay Source # |

Instance details

Defined in Data.Thyme.Calendar.Internal

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> YearMonthDay -> c YearMonthDay

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c YearMonthDay

toConstr :: YearMonthDay -> Constr

dataTypeOf :: YearMonthDay -> DataType

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c YearMonthDay)

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c YearMonthDay)

gmapT :: (forall b. Data b => b -> b) -> YearMonthDay -> YearMonthDay

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> YearMonthDay -> r

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> YearMonthDay -> r

gmapQ :: (forall d. Data d => d -> u) -> YearMonthDay -> [u]

gmapQi :: Int -> (forall d. Data d => d -> u) -> YearMonthDay -> u

gmapM :: Monad m => (forall d. Data d => d -> m d) -> YearMonthDay -> m YearMonthDay

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> YearMonthDay -> m YearMonthDay

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> YearMonthDay -> m YearMonthDay

Ord YearMonthDay Source # |
Instance details Defined in Data.Thyme.Calendar.Internal Methods compare :: YearMonthDay -> YearMonthDay -> Ordering (<) :: YearMonthDay -> YearMonthDay -> Bool (<=) :: YearMonthDay -> YearMonthDay -> Bool (>) :: YearMonthDay -> YearMonthDay -> Bool (>=) :: YearMonthDay -> YearMonthDay -> Bool max :: YearMonthDay -> YearMonthDay -> YearMonthDay min :: YearMonthDay -> YearMonthDay -> YearMonthDay
Show YearMonthDay Source # |
Instance details Defined in Data.Thyme.Calendar.Internal Methods showsPrec :: Int -> YearMonthDay -> ShowS show :: YearMonthDay -> String showList :: [YearMonthDay] -> ShowS
Generic YearMonthDay Source # |
Instance details Defined in Data.Thyme.Calendar.Internal Associated Types type Rep YearMonthDay :: Type -> Type Methods from :: YearMonthDay -> Rep YearMonthDay x to :: Rep YearMonthDay x -> YearMonthDay
Arbitrary YearMonthDay Source # |
Instance details Defined in Data.Thyme.Calendar Methods arbitrary :: Gen YearMonthDay Source # shrink :: YearMonthDay -> [YearMonthDay] Source #
CoArbitrary YearMonthDay Source # |
Instance details Defined in Data.Thyme.Calendar Methods coarbitrary :: YearMonthDay -> Gen b -> Gen b Source #
Random YearMonthDay Source # |

Instance details

Defined in Data.Thyme.Calendar

Methods

randomR :: RandomGen g => (YearMonthDay, YearMonthDay) -> g -> (YearMonthDay, g) Source #

random :: RandomGen g => g -> (YearMonthDay, g) Source #

randomRs :: RandomGen g => (YearMonthDay, YearMonthDay) -> g -> [YearMonthDay] Source #

randoms :: RandomGen g => g -> [YearMonthDay] Source #

randomRIO :: (YearMonthDay, YearMonthDay) -> IO YearMonthDay Source #

randomIO :: IO YearMonthDay Source #

Unbox YearMonthDay Source # |
Instance details Defined in Data.Thyme.Calendar.Internal
NFData YearMonthDay Source # |
Instance details Defined in Data.Thyme.Calendar.Internal Methods rnf :: YearMonthDay -> ()
ParseTime YearMonthDay Source # |
Instance details Defined in Data.Thyme.Format Methods buildTime :: TimeParse -> YearMonthDay Source #
FormatTime YearMonthDay Source # |
Instance details Defined in Data.Thyme.Format Methods showsTime :: TimeLocale -> YearMonthDay -> (Char -> ShowS) -> Char -> ShowS Source #
Vector Vector YearMonthDay Source # |

Instance details

Defined in Data.Thyme.Calendar.Internal

Methods

basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) YearMonthDay -> m (Vector YearMonthDay) Source #

basicUnsafeThaw :: PrimMonad m => Vector YearMonthDay -> m (Mutable Vector (PrimState m) YearMonthDay) Source #

basicLength :: Vector YearMonthDay -> Int Source #

basicUnsafeSlice :: Int -> Int -> Vector YearMonthDay -> Vector YearMonthDay Source #

basicUnsafeIndexM :: Monad m => Vector YearMonthDay -> Int -> m YearMonthDay Source #

basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) YearMonthDay -> Vector YearMonthDay -> m () Source #

elemseq :: Vector YearMonthDay -> YearMonthDay -> b -> b Source #

MVector MVector YearMonthDay Source # |

Instance details

Defined in Data.Thyme.Calendar.Internal

Methods

basicLength :: MVector s YearMonthDay -> Int Source #

basicUnsafeSlice :: Int -> Int -> MVector s YearMonthDay -> MVector s YearMonthDay Source #

basicOverlaps :: MVector s YearMonthDay -> MVector s YearMonthDay -> Bool Source #

basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) YearMonthDay) Source #

basicInitialize :: PrimMonad m => MVector (PrimState m) YearMonthDay -> m () Source #

basicUnsafeReplicate :: PrimMonad m => Int -> YearMonthDay -> m (MVector (PrimState m) YearMonthDay) Source #

basicUnsafeRead :: PrimMonad m => MVector (PrimState m) YearMonthDay -> Int -> m YearMonthDay Source #

basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) YearMonthDay -> Int -> YearMonthDay -> m () Source #

basicClear :: PrimMonad m => MVector (PrimState m) YearMonthDay -> m () Source #

basicSet :: PrimMonad m => MVector (PrimState m) YearMonthDay -> YearMonthDay -> m () Source #

basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) YearMonthDay -> MVector (PrimState m) YearMonthDay -> m () Source #

basicUnsafeMove :: PrimMonad m => MVector (PrimState m) YearMonthDay -> MVector (PrimState m) YearMonthDay -> m () Source #

basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) YearMonthDay -> Int -> m (MVector (PrimState m) YearMonthDay) Source #

type Rep YearMonthDay Source # |

Instance details

Defined in Data.Thyme.Calendar.Internal

type Rep YearMonthDay = D1 ('MetaData "YearMonthDay" "Data.Thyme.Calendar.Internal" "thyme-0.3.5.5-8yk8awDjzEHHYSq2xJCwO3" 'False) (C1 ('MetaCons "YearMonthDay" 'PrefixI 'True) (S1 ('MetaSel ('Just "ymdYear") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Year) :*: (S1 ('MetaSel ('Just "ymdMonth") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Month) :*: S1 ('MetaSel ('Just "ymdDay") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 DayOfMonth))))

newtype Vector YearMonthDay Source # |
Instance details Defined in Data.Thyme.Calendar.Internal newtype Vector YearMonthDay = V_YearMonthDay (Vector Int)
newtype MVector s YearMonthDay Source # |
Instance details Defined in Data.Thyme.Calendar.Internal newtype MVector s YearMonthDay = MV_YearMonthDay (MVector s Int)

isLeapYear :: Year -> Bool Source #

Gregorian leap year?

yearMonthDay :: Iso' OrdinalDate YearMonthDay Source #

gregorian :: Iso' Day YearMonthDay Source #

gregorianValid :: YearMonthDay -> Maybe Day Source #

showGregorian :: Day -> String Source #

gregorianMonthLength :: Year -> Month -> Days Source #

gregorianMonthsClip :: Months -> YearMonthDay -> YearMonthDay Source #

gregorianMonthsRollover :: Months -> YearMonthDay -> YearMonthDay Source #

gregorianYearsClip :: Years -> YearMonthDay -> YearMonthDay Source #

gregorianYearsRollover :: Years -> YearMonthDay -> YearMonthDay Source #

_ymdYear :: Lens' YearMonthDay Year Source #

_ymdMonth :: Lens' YearMonthDay Month Source #

_ymdDay :: Lens' YearMonthDay DayOfMonth Source #

# Orphan instances

Bounded YearMonthDay Source # |
Instance details Methods minBound :: YearMonthDay maxBound :: YearMonthDay
Bounded Day Source # |
Instance details Methods minBound :: Day maxBound :: Day
Arbitrary YearMonthDay Source # |
Instance details Methods arbitrary :: Gen YearMonthDay Source # shrink :: YearMonthDay -> [YearMonthDay] Source #
Arbitrary Day Source # |
Instance details Methods arbitrary :: Gen Day Source # shrink :: Day -> [Day] Source #
CoArbitrary YearMonthDay Source # |
Instance details Methods coarbitrary :: YearMonthDay -> Gen b -> Gen b Source #
Random YearMonthDay Source # |

Instance details

Methods

randomR :: RandomGen g => (YearMonthDay, YearMonthDay) -> g -> (YearMonthDay, g) Source #

random :: RandomGen g => g -> (YearMonthDay, g) Source #

randomRs :: RandomGen g => (YearMonthDay, YearMonthDay) -> g -> [YearMonthDay] Source #

randoms :: RandomGen g => g -> [YearMonthDay] Source #

randomRIO :: (YearMonthDay, YearMonthDay) -> IO YearMonthDay Source #

randomIO :: IO YearMonthDay Source #

Random Day Source # |
Instance details Methods randomR :: RandomGen g => (Day, Day) -> g -> (Day, g) Source # random :: RandomGen g => g -> (Day, g) Source # randomRs :: RandomGen g => (Day, Day) -> g -> [Day] Source # randoms :: RandomGen g => g -> [Day] Source # randomRIO :: (Day, Day) -> IO Day Source # randomIO :: IO Day Source #