diff --git a/src/Javran/AdventOfCode/Y2023/Day2.hs b/src/Javran/AdventOfCode/Y2023/Day2.hs index a02a41ee..d88c3f1c 100644 --- a/src/Javran/AdventOfCode/Y2023/Day2.hs +++ b/src/Javran/AdventOfCode/Y2023/Day2.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE PatternSynonyms #-} - module Javran.AdventOfCode.Y2023.Day2 () where import Data.Monoid hiding (First, Last) @@ -35,15 +33,10 @@ gameLineP = do strP ": " (n,) <$> oneSetP `sepBy1` strP "; " -{- - It would be neat if this sort of thing can be put in some general library instead of us having to - declare it here - which makes it a bit more too verbose to my liking. - -} -pattern MaxRgb :: a -> a -> a -> (Max a, Max a, Max a) -pattern MaxRgb r g b = (Max r, Max g, Max b) - findPower :: GameLine -> Int -findPower = (\(MaxRgb r g b) -> r * g * b) . foldMap (\(Rgb (r, g, b)) -> MaxRgb r g b) +findPower = + (\(Max r, Max g, Max b) -> r * g * b) + . foldMap (\(Rgb (r, g, b)) -> (Max r, Max g, Max b)) instance Solution Day2 where solutionSolved _ = True