projects
/
advent-of-code-22.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Split datafile finding into a library
[advent-of-code-22.git]
/
advent02
/
Main.hs
diff --git
a/advent02/Main.hs
b/advent02/Main.hs
index 44a236173b398a9e5005ebb10c2be8f952f61eb0..231531749fb68bb0ca9d11b7654e15eb3ae06c47 100644
(file)
--- a/
advent02/Main.hs
+++ b/
advent02/Main.hs
@@
-1,6
+1,6
@@
-- Writeup at https://work.njae.me.uk/2022/12/02/advent-of-code-2022-day-2/
-- Writeup at https://work.njae.me.uk/2022/12/02/advent-of-code-2022-day-2/
-import
System.Environment
+import
AoC
import Data.Text ()
import qualified Data.Text.IO as TIO
import Data.Attoparsec.Text hiding (Result)
import Data.Text ()
import qualified Data.Text.IO as TIO
import Data.Attoparsec.Text hiding (Result)
@@
-20,16
+20,6
@@
main =
let match2 = successfulParse2 text
print $ part2 match2
let match2 = successfulParse2 text
print $ part2 match2
-getDataFileName :: IO String
-getDataFileName =
- do args <- getArgs
- progName <- getProgName
- let baseDataName = if null args
- then progName
- else head args
- let dataFileName = "data/" ++ baseDataName ++ ".txt"
- return dataFileName
-
part1 :: [Round] -> Int
part1 = sum . fmap scoreRound
part1 :: [Round] -> Int
part1 = sum . fmap scoreRound