{-# LANGUAGE CPP #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ViewPatterns #-}
module Data.Time.Calendar.Types (
Year,
MonthOfYear,
DayOfMonth,
DayOfYear,
WeekOfYear,
pattern CommonEra,
pattern BeforeCommonEra,
) where
#if MIN_VERSION_time(1,11,0)
import Data.Time.Calendar (DayOfMonth, MonthOfYear, Year)
import Data.Time.Calendar.MonthDay (DayOfYear)
import Data.Time.Calendar.WeekDate (WeekOfYear)
#endif
#if MIN_VERSION_time(1,12,1)
import Data.Time.Calendar (pattern CommonEra, pattern BeforeCommonEra)
#endif
#if !MIN_VERSION_time(1,11,0)
type Year = Integer
type MonthOfYear = Int
type DayOfMonth = Int
type DayOfYear = Int
type WeekOfYear = Int
#endif
#if !MIN_VERSION_time(1,12,1)
pattern CommonEra :: Integer -> Year
pattern CommonEra n <-
((\y -> if y > 0 then Just y else Nothing) -> Just n)
where
CommonEra n = n
pattern BeforeCommonEra :: Integer -> Year
pattern BeforeCommonEra n <-
((\y -> if y <= 0 then Just (1 - y) else Nothing) -> Just n)
where
BeforeCommonEra n = 1 - n
{-# COMPLETE CommonEra, BeforeCommonEra #-}
#endif