{-# LANGUAGE TypeFamilies #-}
module Data.HodaTime.CalendarDateTime.Internal
(
DayNth(..)
,Year
,WeekNumber
,DayOfMonth
,CalendarDate(..)
,NCalendarDate(..)
,CalendarDateTime(..)
,IsCalendar(..)
,HasDate(..)
,LocalTime(..)
,IsCalendarDateTime(..)
,at
)
where
import Data.HodaTime.Instant.Internal (Instant)
import Data.Int (Int32, Int8)
import Data.Word (Word8, Word32)
data DayNth =
FourthToLast
| ThirdToLast
| SecondToLast
| Last
| First
| Second
| Third
| Fourth
| Fifth
deriving (DayNth -> DayNth -> Bool
(DayNth -> DayNth -> Bool)
-> (DayNth -> DayNth -> Bool) -> Eq DayNth
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DayNth -> DayNth -> Bool
== :: DayNth -> DayNth -> Bool
$c/= :: DayNth -> DayNth -> Bool
/= :: DayNth -> DayNth -> Bool
Eq, Int -> DayNth -> ShowS
[DayNth] -> ShowS
DayNth -> String
(Int -> DayNth -> ShowS)
-> (DayNth -> String) -> ([DayNth] -> ShowS) -> Show DayNth
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DayNth -> ShowS
showsPrec :: Int -> DayNth -> ShowS
$cshow :: DayNth -> String
show :: DayNth -> String
$cshowList :: [DayNth] -> ShowS
showList :: [DayNth] -> ShowS
Show, Int -> DayNth
DayNth -> Int
DayNth -> [DayNth]
DayNth -> DayNth
DayNth -> DayNth -> [DayNth]
DayNth -> DayNth -> DayNth -> [DayNth]
(DayNth -> DayNth)
-> (DayNth -> DayNth)
-> (Int -> DayNth)
-> (DayNth -> Int)
-> (DayNth -> [DayNth])
-> (DayNth -> DayNth -> [DayNth])
-> (DayNth -> DayNth -> [DayNth])
-> (DayNth -> DayNth -> DayNth -> [DayNth])
-> Enum DayNth
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: DayNth -> DayNth
succ :: DayNth -> DayNth
$cpred :: DayNth -> DayNth
pred :: DayNth -> DayNth
$ctoEnum :: Int -> DayNth
toEnum :: Int -> DayNth
$cfromEnum :: DayNth -> Int
fromEnum :: DayNth -> Int
$cenumFrom :: DayNth -> [DayNth]
enumFrom :: DayNth -> [DayNth]
$cenumFromThen :: DayNth -> DayNth -> [DayNth]
enumFromThen :: DayNth -> DayNth -> [DayNth]
$cenumFromTo :: DayNth -> DayNth -> [DayNth]
enumFromTo :: DayNth -> DayNth -> [DayNth]
$cenumFromThenTo :: DayNth -> DayNth -> DayNth -> [DayNth]
enumFromThenTo :: DayNth -> DayNth -> DayNth -> [DayNth]
Enum)
type Year = Int
type DayOfMonth = Int
type WeekNumber = Int
data CalendarDate calendar = CalendarDate { forall calendar. CalendarDate calendar -> Int32
cdDays :: Int32, forall calendar. CalendarDate calendar -> Word8
cdDay :: Word8, forall calendar. CalendarDate calendar -> Word8
cdMonth :: Word8, forall calendar. CalendarDate calendar -> Word32
cdYear :: Word32 }
deriving (CalendarDate calendar -> CalendarDate calendar -> Bool
(CalendarDate calendar -> CalendarDate calendar -> Bool)
-> (CalendarDate calendar -> CalendarDate calendar -> Bool)
-> Eq (CalendarDate calendar)
forall calendar.
CalendarDate calendar -> CalendarDate calendar -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall calendar.
CalendarDate calendar -> CalendarDate calendar -> Bool
== :: CalendarDate calendar -> CalendarDate calendar -> Bool
$c/= :: forall calendar.
CalendarDate calendar -> CalendarDate calendar -> Bool
/= :: CalendarDate calendar -> CalendarDate calendar -> Bool
Eq, Int -> CalendarDate calendar -> ShowS
[CalendarDate calendar] -> ShowS
CalendarDate calendar -> String
(Int -> CalendarDate calendar -> ShowS)
-> (CalendarDate calendar -> String)
-> ([CalendarDate calendar] -> ShowS)
-> Show (CalendarDate calendar)
forall calendar. Int -> CalendarDate calendar -> ShowS
forall calendar. [CalendarDate calendar] -> ShowS
forall calendar. CalendarDate calendar -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall calendar. Int -> CalendarDate calendar -> ShowS
showsPrec :: Int -> CalendarDate calendar -> ShowS
$cshow :: forall calendar. CalendarDate calendar -> String
show :: CalendarDate calendar -> String
$cshowList :: forall calendar. [CalendarDate calendar] -> ShowS
showList :: [CalendarDate calendar] -> ShowS
Show, Eq (CalendarDate calendar)
Eq (CalendarDate calendar) =>
(CalendarDate calendar -> CalendarDate calendar -> Ordering)
-> (CalendarDate calendar -> CalendarDate calendar -> Bool)
-> (CalendarDate calendar -> CalendarDate calendar -> Bool)
-> (CalendarDate calendar -> CalendarDate calendar -> Bool)
-> (CalendarDate calendar -> CalendarDate calendar -> Bool)
-> (CalendarDate calendar
-> CalendarDate calendar -> CalendarDate calendar)
-> (CalendarDate calendar
-> CalendarDate calendar -> CalendarDate calendar)
-> Ord (CalendarDate calendar)
CalendarDate calendar -> CalendarDate calendar -> Bool
CalendarDate calendar -> CalendarDate calendar -> Ordering
CalendarDate calendar
-> CalendarDate calendar -> CalendarDate calendar
forall calendar. Eq (CalendarDate calendar)
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall calendar.
CalendarDate calendar -> CalendarDate calendar -> Bool
forall calendar.
CalendarDate calendar -> CalendarDate calendar -> Ordering
forall calendar.
CalendarDate calendar
-> CalendarDate calendar -> CalendarDate calendar
$ccompare :: forall calendar.
CalendarDate calendar -> CalendarDate calendar -> Ordering
compare :: CalendarDate calendar -> CalendarDate calendar -> Ordering
$c< :: forall calendar.
CalendarDate calendar -> CalendarDate calendar -> Bool
< :: CalendarDate calendar -> CalendarDate calendar -> Bool
$c<= :: forall calendar.
CalendarDate calendar -> CalendarDate calendar -> Bool
<= :: CalendarDate calendar -> CalendarDate calendar -> Bool
$c> :: forall calendar.
CalendarDate calendar -> CalendarDate calendar -> Bool
> :: CalendarDate calendar -> CalendarDate calendar -> Bool
$c>= :: forall calendar.
CalendarDate calendar -> CalendarDate calendar -> Bool
>= :: CalendarDate calendar -> CalendarDate calendar -> Bool
$cmax :: forall calendar.
CalendarDate calendar
-> CalendarDate calendar -> CalendarDate calendar
max :: CalendarDate calendar
-> CalendarDate calendar -> CalendarDate calendar
$cmin :: forall calendar.
CalendarDate calendar
-> CalendarDate calendar -> CalendarDate calendar
min :: CalendarDate calendar
-> CalendarDate calendar -> CalendarDate calendar
Ord)
data NCalendarDate calendar = NCalendarDate { forall calendar. NCalendarDate calendar -> Int8
ncdCycle :: Int8, forall calendar. NCalendarDate calendar -> Word8
ncdCentury :: Word8, forall calendar. NCalendarDate calendar -> Word32
ncdDays :: Word32 }
deriving (NCalendarDate calendar -> NCalendarDate calendar -> Bool
(NCalendarDate calendar -> NCalendarDate calendar -> Bool)
-> (NCalendarDate calendar -> NCalendarDate calendar -> Bool)
-> Eq (NCalendarDate calendar)
forall calendar.
NCalendarDate calendar -> NCalendarDate calendar -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall calendar.
NCalendarDate calendar -> NCalendarDate calendar -> Bool
== :: NCalendarDate calendar -> NCalendarDate calendar -> Bool
$c/= :: forall calendar.
NCalendarDate calendar -> NCalendarDate calendar -> Bool
/= :: NCalendarDate calendar -> NCalendarDate calendar -> Bool
Eq, Int -> NCalendarDate calendar -> ShowS
[NCalendarDate calendar] -> ShowS
NCalendarDate calendar -> String
(Int -> NCalendarDate calendar -> ShowS)
-> (NCalendarDate calendar -> String)
-> ([NCalendarDate calendar] -> ShowS)
-> Show (NCalendarDate calendar)
forall calendar. Int -> NCalendarDate calendar -> ShowS
forall calendar. [NCalendarDate calendar] -> ShowS
forall calendar. NCalendarDate calendar -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall calendar. Int -> NCalendarDate calendar -> ShowS
showsPrec :: Int -> NCalendarDate calendar -> ShowS
$cshow :: forall calendar. NCalendarDate calendar -> String
show :: NCalendarDate calendar -> String
$cshowList :: forall calendar. [NCalendarDate calendar] -> ShowS
showList :: [NCalendarDate calendar] -> ShowS
Show, Eq (NCalendarDate calendar)
Eq (NCalendarDate calendar) =>
(NCalendarDate calendar -> NCalendarDate calendar -> Ordering)
-> (NCalendarDate calendar -> NCalendarDate calendar -> Bool)
-> (NCalendarDate calendar -> NCalendarDate calendar -> Bool)
-> (NCalendarDate calendar -> NCalendarDate calendar -> Bool)
-> (NCalendarDate calendar -> NCalendarDate calendar -> Bool)
-> (NCalendarDate calendar
-> NCalendarDate calendar -> NCalendarDate calendar)
-> (NCalendarDate calendar
-> NCalendarDate calendar -> NCalendarDate calendar)
-> Ord (NCalendarDate calendar)
NCalendarDate calendar -> NCalendarDate calendar -> Bool
NCalendarDate calendar -> NCalendarDate calendar -> Ordering
NCalendarDate calendar
-> NCalendarDate calendar -> NCalendarDate calendar
forall calendar. Eq (NCalendarDate calendar)
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall calendar.
NCalendarDate calendar -> NCalendarDate calendar -> Bool
forall calendar.
NCalendarDate calendar -> NCalendarDate calendar -> Ordering
forall calendar.
NCalendarDate calendar
-> NCalendarDate calendar -> NCalendarDate calendar
$ccompare :: forall calendar.
NCalendarDate calendar -> NCalendarDate calendar -> Ordering
compare :: NCalendarDate calendar -> NCalendarDate calendar -> Ordering
$c< :: forall calendar.
NCalendarDate calendar -> NCalendarDate calendar -> Bool
< :: NCalendarDate calendar -> NCalendarDate calendar -> Bool
$c<= :: forall calendar.
NCalendarDate calendar -> NCalendarDate calendar -> Bool
<= :: NCalendarDate calendar -> NCalendarDate calendar -> Bool
$c> :: forall calendar.
NCalendarDate calendar -> NCalendarDate calendar -> Bool
> :: NCalendarDate calendar -> NCalendarDate calendar -> Bool
$c>= :: forall calendar.
NCalendarDate calendar -> NCalendarDate calendar -> Bool
>= :: NCalendarDate calendar -> NCalendarDate calendar -> Bool
$cmax :: forall calendar.
NCalendarDate calendar
-> NCalendarDate calendar -> NCalendarDate calendar
max :: NCalendarDate calendar
-> NCalendarDate calendar -> NCalendarDate calendar
$cmin :: forall calendar.
NCalendarDate calendar
-> NCalendarDate calendar -> NCalendarDate calendar
min :: NCalendarDate calendar
-> NCalendarDate calendar -> NCalendarDate calendar
Ord)
class IsCalendar cal where
type Date cal
data DayOfWeek cal
data Month cal
day' :: Functor f => (DayOfMonth -> f DayOfMonth) -> CalendarDate cal -> f (CalendarDate cal)
month' :: CalendarDate cal -> Month cal
monthl' :: Functor f => (Int -> f Int) -> CalendarDate cal -> f (CalendarDate cal)
year' :: Functor f => (Year -> f Year) -> CalendarDate cal -> f (CalendarDate cal)
dayOfWeek' :: CalendarDate cal -> DayOfWeek cal
next' :: Int -> DayOfWeek cal -> CalendarDate cal -> CalendarDate cal
previous' :: Int -> DayOfWeek cal -> CalendarDate cal -> CalendarDate cal
class HasDate d where
type DoW d
type MoY d
day :: Functor f => (DayOfMonth -> f DayOfMonth) -> d -> f d
month :: d -> MoY d
monthl :: Functor f => (Int -> f Int) -> d -> f d
year :: Functor f => (Year -> f Year) -> d -> f d
dayOfWeek :: d -> DoW d
next :: Int -> DoW d -> d -> d
previous :: Int -> DoW d -> d -> d
instance (IsCalendar cal) => HasDate (CalendarDate cal) where
type DoW (CalendarDate cal) = DayOfWeek cal
type MoY (CalendarDate cal) = Month cal
day :: forall (f :: * -> *).
Functor f =>
(Int -> f Int) -> CalendarDate cal -> f (CalendarDate cal)
day = (Int -> f Int) -> CalendarDate cal -> f (CalendarDate cal)
forall cal (f :: * -> *).
(IsCalendar cal, Functor f) =>
(Int -> f Int) -> CalendarDate cal -> f (CalendarDate cal)
forall (f :: * -> *).
Functor f =>
(Int -> f Int) -> CalendarDate cal -> f (CalendarDate cal)
day'
month :: CalendarDate cal -> MoY (CalendarDate cal)
month = CalendarDate cal -> MoY (CalendarDate cal)
CalendarDate cal -> Month cal
forall cal. IsCalendar cal => CalendarDate cal -> Month cal
month'
monthl :: forall (f :: * -> *).
Functor f =>
(Int -> f Int) -> CalendarDate cal -> f (CalendarDate cal)
monthl = (Int -> f Int) -> CalendarDate cal -> f (CalendarDate cal)
forall cal (f :: * -> *).
(IsCalendar cal, Functor f) =>
(Int -> f Int) -> CalendarDate cal -> f (CalendarDate cal)
forall (f :: * -> *).
Functor f =>
(Int -> f Int) -> CalendarDate cal -> f (CalendarDate cal)
monthl'
year :: forall (f :: * -> *).
Functor f =>
(Int -> f Int) -> CalendarDate cal -> f (CalendarDate cal)
year = (Int -> f Int) -> CalendarDate cal -> f (CalendarDate cal)
forall cal (f :: * -> *).
(IsCalendar cal, Functor f) =>
(Int -> f Int) -> CalendarDate cal -> f (CalendarDate cal)
forall (f :: * -> *).
Functor f =>
(Int -> f Int) -> CalendarDate cal -> f (CalendarDate cal)
year'
dayOfWeek :: CalendarDate cal -> DoW (CalendarDate cal)
dayOfWeek = CalendarDate cal -> DoW (CalendarDate cal)
CalendarDate cal -> DayOfWeek cal
forall cal. IsCalendar cal => CalendarDate cal -> DayOfWeek cal
dayOfWeek'
next :: Int
-> DoW (CalendarDate cal) -> CalendarDate cal -> CalendarDate cal
next = Int
-> DoW (CalendarDate cal) -> CalendarDate cal -> CalendarDate cal
Int -> DayOfWeek cal -> CalendarDate cal -> CalendarDate cal
forall cal.
IsCalendar cal =>
Int -> DayOfWeek cal -> CalendarDate cal -> CalendarDate cal
next'
previous :: Int
-> DoW (CalendarDate cal) -> CalendarDate cal -> CalendarDate cal
previous = Int
-> DoW (CalendarDate cal) -> CalendarDate cal -> CalendarDate cal
Int -> DayOfWeek cal -> CalendarDate cal -> CalendarDate cal
forall cal.
IsCalendar cal =>
Int -> DayOfWeek cal -> CalendarDate cal -> CalendarDate cal
previous'
data LocalTime = LocalTime { LocalTime -> Word32
ltSecs :: Word32, LocalTime -> Word32
ltNsecs :: Word32 }
deriving (LocalTime -> LocalTime -> Bool
(LocalTime -> LocalTime -> Bool)
-> (LocalTime -> LocalTime -> Bool) -> Eq LocalTime
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LocalTime -> LocalTime -> Bool
== :: LocalTime -> LocalTime -> Bool
$c/= :: LocalTime -> LocalTime -> Bool
/= :: LocalTime -> LocalTime -> Bool
Eq, Eq LocalTime
Eq LocalTime =>
(LocalTime -> LocalTime -> Ordering)
-> (LocalTime -> LocalTime -> Bool)
-> (LocalTime -> LocalTime -> Bool)
-> (LocalTime -> LocalTime -> Bool)
-> (LocalTime -> LocalTime -> Bool)
-> (LocalTime -> LocalTime -> LocalTime)
-> (LocalTime -> LocalTime -> LocalTime)
-> Ord LocalTime
LocalTime -> LocalTime -> Bool
LocalTime -> LocalTime -> Ordering
LocalTime -> LocalTime -> LocalTime
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: LocalTime -> LocalTime -> Ordering
compare :: LocalTime -> LocalTime -> Ordering
$c< :: LocalTime -> LocalTime -> Bool
< :: LocalTime -> LocalTime -> Bool
$c<= :: LocalTime -> LocalTime -> Bool
<= :: LocalTime -> LocalTime -> Bool
$c> :: LocalTime -> LocalTime -> Bool
> :: LocalTime -> LocalTime -> Bool
$c>= :: LocalTime -> LocalTime -> Bool
>= :: LocalTime -> LocalTime -> Bool
$cmax :: LocalTime -> LocalTime -> LocalTime
max :: LocalTime -> LocalTime -> LocalTime
$cmin :: LocalTime -> LocalTime -> LocalTime
min :: LocalTime -> LocalTime -> LocalTime
Ord, Int -> LocalTime -> ShowS
[LocalTime] -> ShowS
LocalTime -> String
(Int -> LocalTime -> ShowS)
-> (LocalTime -> String)
-> ([LocalTime] -> ShowS)
-> Show LocalTime
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LocalTime -> ShowS
showsPrec :: Int -> LocalTime -> ShowS
$cshow :: LocalTime -> String
show :: LocalTime -> String
$cshowList :: [LocalTime] -> ShowS
showList :: [LocalTime] -> ShowS
Show)
data CalendarDateTime calendar = CalendarDateTime (CalendarDate calendar) LocalTime
deriving (CalendarDateTime calendar -> CalendarDateTime calendar -> Bool
(CalendarDateTime calendar -> CalendarDateTime calendar -> Bool)
-> (CalendarDateTime calendar -> CalendarDateTime calendar -> Bool)
-> Eq (CalendarDateTime calendar)
forall calendar.
CalendarDateTime calendar -> CalendarDateTime calendar -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall calendar.
CalendarDateTime calendar -> CalendarDateTime calendar -> Bool
== :: CalendarDateTime calendar -> CalendarDateTime calendar -> Bool
$c/= :: forall calendar.
CalendarDateTime calendar -> CalendarDateTime calendar -> Bool
/= :: CalendarDateTime calendar -> CalendarDateTime calendar -> Bool
Eq, Int -> CalendarDateTime calendar -> ShowS
[CalendarDateTime calendar] -> ShowS
CalendarDateTime calendar -> String
(Int -> CalendarDateTime calendar -> ShowS)
-> (CalendarDateTime calendar -> String)
-> ([CalendarDateTime calendar] -> ShowS)
-> Show (CalendarDateTime calendar)
forall calendar. Int -> CalendarDateTime calendar -> ShowS
forall calendar. [CalendarDateTime calendar] -> ShowS
forall calendar. CalendarDateTime calendar -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall calendar. Int -> CalendarDateTime calendar -> ShowS
showsPrec :: Int -> CalendarDateTime calendar -> ShowS
$cshow :: forall calendar. CalendarDateTime calendar -> String
show :: CalendarDateTime calendar -> String
$cshowList :: forall calendar. [CalendarDateTime calendar] -> ShowS
showList :: [CalendarDateTime calendar] -> ShowS
Show, Eq (CalendarDateTime calendar)
Eq (CalendarDateTime calendar) =>
(CalendarDateTime calendar
-> CalendarDateTime calendar -> Ordering)
-> (CalendarDateTime calendar -> CalendarDateTime calendar -> Bool)
-> (CalendarDateTime calendar -> CalendarDateTime calendar -> Bool)
-> (CalendarDateTime calendar -> CalendarDateTime calendar -> Bool)
-> (CalendarDateTime calendar -> CalendarDateTime calendar -> Bool)
-> (CalendarDateTime calendar
-> CalendarDateTime calendar -> CalendarDateTime calendar)
-> (CalendarDateTime calendar
-> CalendarDateTime calendar -> CalendarDateTime calendar)
-> Ord (CalendarDateTime calendar)
CalendarDateTime calendar -> CalendarDateTime calendar -> Bool
CalendarDateTime calendar -> CalendarDateTime calendar -> Ordering
CalendarDateTime calendar
-> CalendarDateTime calendar -> CalendarDateTime calendar
forall calendar. Eq (CalendarDateTime calendar)
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall calendar.
CalendarDateTime calendar -> CalendarDateTime calendar -> Bool
forall calendar.
CalendarDateTime calendar -> CalendarDateTime calendar -> Ordering
forall calendar.
CalendarDateTime calendar
-> CalendarDateTime calendar -> CalendarDateTime calendar
$ccompare :: forall calendar.
CalendarDateTime calendar -> CalendarDateTime calendar -> Ordering
compare :: CalendarDateTime calendar -> CalendarDateTime calendar -> Ordering
$c< :: forall calendar.
CalendarDateTime calendar -> CalendarDateTime calendar -> Bool
< :: CalendarDateTime calendar -> CalendarDateTime calendar -> Bool
$c<= :: forall calendar.
CalendarDateTime calendar -> CalendarDateTime calendar -> Bool
<= :: CalendarDateTime calendar -> CalendarDateTime calendar -> Bool
$c> :: forall calendar.
CalendarDateTime calendar -> CalendarDateTime calendar -> Bool
> :: CalendarDateTime calendar -> CalendarDateTime calendar -> Bool
$c>= :: forall calendar.
CalendarDateTime calendar -> CalendarDateTime calendar -> Bool
>= :: CalendarDateTime calendar -> CalendarDateTime calendar -> Bool
$cmax :: forall calendar.
CalendarDateTime calendar
-> CalendarDateTime calendar -> CalendarDateTime calendar
max :: CalendarDateTime calendar
-> CalendarDateTime calendar -> CalendarDateTime calendar
$cmin :: forall calendar.
CalendarDateTime calendar
-> CalendarDateTime calendar -> CalendarDateTime calendar
min :: CalendarDateTime calendar
-> CalendarDateTime calendar -> CalendarDateTime calendar
Ord)
instance (IsCalendar cal) => HasDate (CalendarDateTime cal) where
type DoW (CalendarDateTime cal) = DayOfWeek cal
type MoY (CalendarDateTime cal) = Month cal
day :: forall (f :: * -> *).
Functor f =>
(Int -> f Int) -> CalendarDateTime cal -> f (CalendarDateTime cal)
day Int -> f Int
f (CalendarDateTime CalendarDate cal
cd LocalTime
lt) = (CalendarDate cal -> LocalTime -> CalendarDateTime cal)
-> LocalTime -> CalendarDate cal -> CalendarDateTime cal
forall a b c. (a -> b -> c) -> b -> a -> c
flip CalendarDate cal -> LocalTime -> CalendarDateTime cal
forall calendar.
CalendarDate calendar -> LocalTime -> CalendarDateTime calendar
CalendarDateTime LocalTime
lt (CalendarDate cal -> CalendarDateTime cal)
-> f (CalendarDate cal) -> f (CalendarDateTime cal)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> f Int) -> CalendarDate cal -> f (CalendarDate cal)
forall d (f :: * -> *).
(HasDate d, Functor f) =>
(Int -> f Int) -> d -> f d
forall (f :: * -> *).
Functor f =>
(Int -> f Int) -> CalendarDate cal -> f (CalendarDate cal)
day Int -> f Int
f CalendarDate cal
cd
month :: CalendarDateTime cal -> MoY (CalendarDateTime cal)
month (CalendarDateTime CalendarDate cal
cd LocalTime
_) = CalendarDate cal -> MoY (CalendarDate cal)
forall d. HasDate d => d -> MoY d
month CalendarDate cal
cd
monthl :: forall (f :: * -> *).
Functor f =>
(Int -> f Int) -> CalendarDateTime cal -> f (CalendarDateTime cal)
monthl Int -> f Int
f (CalendarDateTime CalendarDate cal
cd LocalTime
lt) = (CalendarDate cal -> LocalTime -> CalendarDateTime cal)
-> LocalTime -> CalendarDate cal -> CalendarDateTime cal
forall a b c. (a -> b -> c) -> b -> a -> c
flip CalendarDate cal -> LocalTime -> CalendarDateTime cal
forall calendar.
CalendarDate calendar -> LocalTime -> CalendarDateTime calendar
CalendarDateTime LocalTime
lt (CalendarDate cal -> CalendarDateTime cal)
-> f (CalendarDate cal) -> f (CalendarDateTime cal)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> f Int) -> CalendarDate cal -> f (CalendarDate cal)
forall d (f :: * -> *).
(HasDate d, Functor f) =>
(Int -> f Int) -> d -> f d
forall (f :: * -> *).
Functor f =>
(Int -> f Int) -> CalendarDate cal -> f (CalendarDate cal)
monthl Int -> f Int
f CalendarDate cal
cd
year :: forall (f :: * -> *).
Functor f =>
(Int -> f Int) -> CalendarDateTime cal -> f (CalendarDateTime cal)
year Int -> f Int
f (CalendarDateTime CalendarDate cal
cd LocalTime
lt) = (CalendarDate cal -> LocalTime -> CalendarDateTime cal)
-> LocalTime -> CalendarDate cal -> CalendarDateTime cal
forall a b c. (a -> b -> c) -> b -> a -> c
flip CalendarDate cal -> LocalTime -> CalendarDateTime cal
forall calendar.
CalendarDate calendar -> LocalTime -> CalendarDateTime calendar
CalendarDateTime LocalTime
lt (CalendarDate cal -> CalendarDateTime cal)
-> f (CalendarDate cal) -> f (CalendarDateTime cal)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Int -> f Int) -> CalendarDate cal -> f (CalendarDate cal)
forall d (f :: * -> *).
(HasDate d, Functor f) =>
(Int -> f Int) -> d -> f d
forall (f :: * -> *).
Functor f =>
(Int -> f Int) -> CalendarDate cal -> f (CalendarDate cal)
year Int -> f Int
f CalendarDate cal
cd
dayOfWeek :: CalendarDateTime cal -> DoW (CalendarDateTime cal)
dayOfWeek (CalendarDateTime CalendarDate cal
cd LocalTime
_) = CalendarDate cal -> DoW (CalendarDate cal)
forall d. HasDate d => d -> DoW d
dayOfWeek CalendarDate cal
cd
next :: Int
-> DoW (CalendarDateTime cal)
-> CalendarDateTime cal
-> CalendarDateTime cal
next Int
i DoW (CalendarDateTime cal)
dow (CalendarDateTime CalendarDate cal
cd LocalTime
lt) = CalendarDate cal -> LocalTime -> CalendarDateTime cal
forall calendar.
CalendarDate calendar -> LocalTime -> CalendarDateTime calendar
CalendarDateTime (Int
-> DoW (CalendarDate cal) -> CalendarDate cal -> CalendarDate cal
forall d. HasDate d => Int -> DoW d -> d -> d
next Int
i DoW (CalendarDateTime cal)
DoW (CalendarDate cal)
dow CalendarDate cal
cd) LocalTime
lt
previous :: Int
-> DoW (CalendarDateTime cal)
-> CalendarDateTime cal
-> CalendarDateTime cal
previous Int
i DoW (CalendarDateTime cal)
dow (CalendarDateTime CalendarDate cal
cd LocalTime
lt) = CalendarDate cal -> LocalTime -> CalendarDateTime cal
forall calendar.
CalendarDate calendar -> LocalTime -> CalendarDateTime calendar
CalendarDateTime (Int
-> DoW (CalendarDate cal) -> CalendarDate cal -> CalendarDate cal
forall d. HasDate d => Int -> DoW d -> d -> d
previous Int
i DoW (CalendarDateTime cal)
DoW (CalendarDate cal)
dow CalendarDate cal
cd) LocalTime
lt
class IsCalendarDateTime cal where
fromAdjustedInstant :: Instant -> CalendarDateTime cal
toUnadjustedInstant :: CalendarDateTime cal -> Instant
at :: CalendarDate cal -> LocalTime -> CalendarDateTime cal
at :: forall calendar.
CalendarDate calendar -> LocalTime -> CalendarDateTime calendar
at = CalendarDate cal -> LocalTime -> CalendarDateTime cal
forall calendar.
CalendarDate calendar -> LocalTime -> CalendarDateTime calendar
CalendarDateTime