projects
/
advent-of-code-23.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tidying, mainly parsers
[advent-of-code-23.git]
/
advent18
/
Main.hs
diff --git
a/advent18/Main.hs
b/advent18/Main.hs
index 7cccd05d3e9784c5148d44496340fcd20699825e..97bcf6d35396769877a2f839c949de90882f2e23 100644
(file)
--- a/
advent18/Main.hs
+++ b/
advent18/Main.hs
@@
-1,4
+1,4
@@
--- Writeup at https://work.njae.me.uk/2023/12/
18/advent-of-code-2023-day-15
/
+-- Writeup at https://work.njae.me.uk/2023/12/
22/advent-of-code-2023-day-18
/
import AoC
import AoC
@@
-79,9
+79,9
@@
direction2P = choice [ U <$ "3"
instructions2P = instruction2P `sepBy` endOfLine
instruction2P =
instructions2P = instruction2P `sepBy` endOfLine
instruction2P =
- instrify <$
> (preambleP *> (AT.take 5)) <*> (direction2P <* ")")
+ instrify <$
preambleP <*> AT.take 5 <*> direction2P <* ")"
-preambleP =
(direction1P *> " " *> decimal <* " (#")
+preambleP =
direction1P *> " " *> decimal <* " (#"
instrify :: Text -> Direction -> Instruction
instrify h d = Instr d (fst $ fromRight (0, "") $ TR.hexadecimal h)
instrify :: Text -> Direction -> Instruction
instrify h d = Instr d (fst $ fromRight (0, "") $ TR.hexadecimal h)