X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=advent02%2FMainApplicative.hs;h=acbcb5fa6741aa1b52ecbeb8a5b5b099283cb344;hb=HEAD;hp=14cb248db042a1fb0a851608c4e7fbc5e7a71f70;hpb=6bab7cfb5555d7c4148c951ffb2454849bce6ac0;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"