X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=advent18%2FMain.hs;h=97bcf6d35396769877a2f839c949de90882f2e23;hb=a7b02636b8045a73a4dff090c1b932cfa1afd9bd;hp=7cccd05d3e9784c5148d44496340fcd20699825e;hpb=320c134b0e7dd42100c71316223f56c4682b954f;p=advent-of-code-23.git diff --git a/advent18/Main.hs b/advent18/Main.hs index 7cccd05..97bcf6d 100644 --- 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 @@ -79,9 +79,9 @@ direction2P = choice [ U <$ "3" 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)