Most years have 52 weeks, some have 53, according to ISO8601.



Task

Write a function which determines if a given year is long (53 weeks) or not, and demonstrate it.




import Data.Time.Calendar (fromGregorian)
import Data.Time.Calendar.WeekDate (toWeekDate)
 
longYear :: Integer -> Bool
longYear y =
  let (_, w, _) = toWeekDate $ fromGregorian y 12 28
   in 52 < w
 
main :: IO ()
main = mapM_ print $ filter longYear [2000 .. 2100]