-
-
Save Changaco/9475376 to your computer and use it in GitHub Desktop.
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 Data.Time.Clock | |
import Data.Time.Calendar | |
currentDate :: IO (Integer, Int, Int) | |
currentDate = fmap (toGregorian . utctDay) getCurrentTime | |
daysOfMonth :: Integer -> Int -> [Day] | |
daysOfMonth year month = map (fromGregorian year month) [1..gregorianMonthLength year month] | |
main = do | |
(year, month, _) <- currentDate | |
let days = daysOfMonth year month | |
putStrLn $ "Days: " ++ (show $ length days) | |
mapM_ print days |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment