Last active
August 29, 2015 14:02
-
-
Save masak/abc315b79968dea31096 to your computer and use it in GitHub Desktop.
Find all Fridays-the-13th in the years 2012..2017
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Monad | |
import Data.Time.Calendar | |
import Data.Time.Calendar.WeekDate | |
main = do | |
forM_ [2012..2017] $ \year -> do | |
forM_ [1..12] $ \month -> do | |
let date = fromGregorian year month 13 | |
let (_, _, weekDay) = toWeekDate date | |
when (weekDay == 5) (putStrLn . showGregorian $ date) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment