X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=advent02%2FMainApplicative.hs;h=acbcb5fa6741aa1b52ecbeb8a5b5b099283cb344;hb=a7b02636b8045a73a4dff090c1b932cfa1afd9bd;hp=14cb248db042a1fb0a851608c4e7fbc5e7a71f70;hpb=bc689ec22856749b96406382eac0345f2f71cb40;p=advent-of-code-23.git diff --git a/advent02/MainApplicative.hs b/advent02/MainApplicative.hs index 14cb248..acbcb5f 100644 --- a/advent02/MainApplicative.hs +++ b/advent02/MainApplicative.hs @@ -85,11 +85,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"