From 18c628d362dbce2b665a9c4b9627781f41857927 Mon Sep 17 00:00:00 2001 From: Javran Cheng Date: Sat, 6 Jan 2024 18:03:11 -0800 Subject: [PATCH] drop the pattern, too verbose. --- src/Javran/AdventOfCode/Y2023/Day2.hs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) 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