-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDays.hs
32 lines (28 loc) · 838 Bytes
/
Days.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
module Days (
findDay,
runDay
) where
import Common
import Data.Map
import Days.Day1
import Days.Day2
import Days.Day4
import Days.Day3
import Days.Day5
import Days.Day6
import Days.Day7
days :: Map Int ((IO (), IO ()))
days = fromList [
(1, (solveDay1Part1, solveDay1Part2)),
(2, (solveDay2Part1, solveDay2Part2)),
(3, (solveDay3Part1, solveDay3Part2)),
(4, (solveDay4Part1, solveDay4Part2)),
(5, (solveDay5Part1, solveDay5Part2)),
(6, (solveDay6Part1, solveDay6Part2)),
(7, (solveDay7Part1, solveDay7Part2))
]
findDay :: Int -> Maybe ((IO (), IO ()))
findDay = flip Data.Map.lookup days
runDay :: Maybe ((IO (), IO ())) -> Bool -> IO ()
runDay Nothing _ = putStrLn "Day not found"
runDay (Just day) x = if x then fst day else snd day