X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=advent02%2FMain.hs;h=e8e8f03e3ca90b5f7f404079e1baec1d13c0d035;hb=14a708ee545a9bd6d81205177ab9baabd29d1894;hp=2e96f1b040fa2867f9e34d5a174464e4921bf2bd;hpb=dc80ddf4a646ba69d6fafd173afb7ad4d8520f8c;p=advent-of-code-23.git diff --git a/advent02/Main.hs b/advent02/Main.hs index 2e96f1b..e8e8f03 100644 --- a/advent02/Main.hs +++ b/advent02/Main.hs @@ -91,11 +91,11 @@ cubeP :: Parser Cube 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` ", " -cubeP = (flip Cube) <$> (decimal <* " ") <*> colourP +cubeP = (flip Cube) <$> decimal <* " " <*> colourP colourP = redP <|> greenP <|> blueP redP = Red <$ "red"