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]
/
advent05
/
Main.hs
diff --git
a/advent05/Main.hs
b/advent05/Main.hs
index 21daf434eb0f17035f9b4542a926e88e56235291..0b60f36fa0383dd000f6cadb345dba9a2976d915 100644
(file)
--- a/
advent05/Main.hs
+++ b/
advent05/Main.hs
@@
-1,6
+1,6
@@
-- Writeup at https://work.njae.me.uk/2022/12/04/advent-of-code-2022-day-4/
-- Writeup at https://work.njae.me.uk/2022/12/04/advent-of-code-2022-day-4/
-import
System.Environment
+import
AoC
import Data.Text (Text)
import qualified Data.Text.IO as TIO
import Data.Attoparsec.Text hiding (take)
import Data.Text (Text)
import qualified Data.Text.IO as TIO
import Data.Attoparsec.Text hiding (take)
@@
-26,18
+26,6
@@
main =
putStrLn $ part1 wharf moves
putStrLn $ part2 wharf moves
putStrLn $ part1 wharf moves
putStrLn $ part2 wharf moves
-
-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 :: Wharf -> [Move] -> String
part1 wharf moves = showTops $ applyMoves1 wharf moves
part1 :: Wharf -> [Move] -> String
part1 wharf moves = showTops $ applyMoves1 wharf moves