module Data.Time.Calendar.BankHoliday
( isWeekend
, isWeekday
, yearFromDay
) where
import Data.Time
isWeekend :: Day -> Bool
isWeekend :: Day -> Bool
isWeekend Day
d = Day -> Integer
toModifiedJulianDay Day
d Integer -> Integer -> Integer
forall a. Integral a => a -> a -> a
`mod` Integer
7 Integer -> [Integer] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Integer
3,Integer
4]
isWeekday :: Day -> Bool
isWeekday :: Day -> Bool
isWeekday = Bool -> Bool
not (Bool -> Bool) -> (Day -> Bool) -> Day -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Day -> Bool
isWeekend
yearFromDay :: Day -> Integer
yearFromDay :: Day -> Integer
yearFromDay = (Integer, Int, Int) -> Integer
forall a b c. (a, b, c) -> a
fst' ((Integer, Int, Int) -> Integer)
-> (Day -> (Integer, Int, Int)) -> Day -> Integer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Day -> (Integer, Int, Int)
toGregorian
where
fst' :: (a,b,c) -> a
fst' :: (a, b, c) -> a
fst' (a
x,b
_,c
_) = a
x