thyme-0.3.5.5: A faster time library

Safe Haskell | None
Language | Haskell2010

Data.Thyme.Calendar

Contents

- Days
- Gregorian calendar
- Orphan instances

Description

`UTCView` 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

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

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

toConstr :: Day -> Constr Source #

dataTypeOf :: Day -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Ord Day Source # |
Instance details Defined in Data.Thyme.Calendar.Internal Methods compare :: Day -> Day -> Ordering Source # (<) :: Day -> Day -> Bool Source # (<=) :: Day -> Day -> Bool Source # (>) :: Day -> Day -> Bool Source # (>=) :: Day -> Day -> Bool Source # max :: Day -> Day -> Day Source # min :: Day -> Day -> Day Source #
Read Day Source # |
Instance details Defined in Data.Thyme.Format Methods readsPrec :: Int -> ReadS Day Source # readList :: ReadS [Day] Source # readPrec :: ReadPrec Day Source # readListPrec :: ReadPrec [Day] Source #
Show Day Source # |
Instance details Defined in Data.Thyme.Calendar.Internal Methods showsPrec :: Int -> Day -> ShowS Source # show :: Day -> String Source # showList :: [Day] -> ShowS Source #
Ix Day Source # |
Instance details Defined in Data.Thyme.Calendar.Internal Methods range :: (Day, Day) -> [Day] Source # index :: (Day, Day) -> Day -> Int Source # unsafeIndex :: (Day, Day) -> Day -> Int inRange :: (Day, Day) -> Day -> Bool Source # rangeSize :: (Day, Day) -> Int Source # unsafeRangeSize :: (Day, Day) -> Int
Generic Day Source # |
Instance details Defined in Data.Thyme.Calendar.Internal Associated Types type Rep Day :: Type -> Type Source # Methods from :: Day -> Rep Day x Source # to :: Rep Day x -> Day Source #
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 #
NFData Day Source # |
Instance details Defined in Data.Thyme.Calendar.Internal Methods rnf :: Day -> () 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 :: Type Source # Methods (.-.) :: Day -> Day -> Diff Day Source # (.+^) :: Day -> Diff Day -> Day Source #
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-Fg1pPOWWkee1p55oP1P4W4" 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

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

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

toConstr :: YearMonthDay -> Constr Source #

dataTypeOf :: YearMonthDay -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Ord YearMonthDay Source # |

Instance details

Defined in Data.Thyme.Calendar.Internal

Methods

compare :: YearMonthDay -> YearMonthDay -> Ordering Source #

(<) :: YearMonthDay -> YearMonthDay -> Bool Source #

(<=) :: YearMonthDay -> YearMonthDay -> Bool Source #

(>) :: YearMonthDay -> YearMonthDay -> Bool Source #

(>=) :: YearMonthDay -> YearMonthDay -> Bool Source #

max :: YearMonthDay -> YearMonthDay -> YearMonthDay Source #

min :: YearMonthDay -> YearMonthDay -> YearMonthDay Source #

Show YearMonthDay Source # |
Instance details Defined in Data.Thyme.Calendar.Internal Methods showsPrec :: Int -> YearMonthDay -> ShowS Source # show :: YearMonthDay -> String Source # showList :: [YearMonthDay] -> ShowS Source #
Generic YearMonthDay Source # |
Instance details Defined in Data.Thyme.Calendar.Internal Associated Types type Rep YearMonthDay :: Type -> Type Source # Methods from :: YearMonthDay -> Rep YearMonthDay x Source # to :: Rep YearMonthDay x -> YearMonthDay Source #
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 #
NFData YearMonthDay Source # |
Instance details Defined in Data.Thyme.Calendar.Internal Methods rnf :: YearMonthDay -> () 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
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-Fg1pPOWWkee1p55oP1P4W4" 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 Source # maxBound :: YearMonthDay Source #
Bounded Day Source # |
Instance details Methods minBound :: Day Source # maxBound :: Day Source #
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 #