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
Tweaking and tidying
[advent-of-code-23.git]
/
advent02
/
Main.hs
diff --git
a/advent02/Main.hs
b/advent02/Main.hs
index d33a26b47d23148a156f349075f7e57fccfbbf83..e8e8f03e3ca90b5f7f404079e1baec1d13c0d035 100644
(file)
--- a/
advent02/Main.hs
+++ b/
advent02/Main.hs
@@
-1,4
+1,4
@@
--- Writeup at https://work.njae.me.uk/202
2/12/02/advent-of-code-2022-day-
2/
+-- Writeup at https://work.njae.me.uk/202
3/12/02/advent-of-code-2023-day-0
2/
import AoC
import Data.Text (Text)
import AoC
import Data.Text (Text)
@@
-91,11
+91,11
@@
cubeP :: Parser Cube
colourP, redP, greenP, blueP :: Parser Colour
gamesP = gameP `sepBy` endOfLine
colourP, redP, greenP, blueP :: Parser Colour
gamesP = gameP `sepBy` endOfLine
-gameP = ParsedGame <$
> (("Game " *> decimal) <* ": ")
<*> showingsP
+gameP = ParsedGame <$
"Game " <*> decimal <* ": "
<*> showingsP
showingsP = showingP `sepBy` "; "
showingP = cubeP `sepBy` ", "
showingsP = showingP `sepBy` "; "
showingP = cubeP `sepBy` ", "
-cubeP = (flip Cube) <$>
(decimal <* " ")
<*> colourP
+cubeP = (flip Cube) <$>
decimal <* " "
<*> colourP
colourP = redP <|> greenP <|> blueP
redP = Red <$ "red"
colourP = redP <|> greenP <|> blueP
redP = Red <$ "red"