From 6f5e8868515306ca398452a5f22fed76e1a2132f Mon Sep 17 00:00:00 2001 From: Siphalor Date: Sun, 8 Dec 2024 14:03:08 +0100 Subject: [PATCH] Day eight: Tuple sections :3 --- day-08-haskell/src/Common.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/day-08-haskell/src/Common.hs b/day-08-haskell/src/Common.hs index f7c1d10..bd8cbc3 100644 --- a/day-08-haskell/src/Common.hs +++ b/day-08-haskell/src/Common.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE TupleSections #-} module Common where import Data.Foldable (toList) @@ -11,7 +12,7 @@ pairPermutations :: [a] -> [(a, a)] pairPermutations [] = [] pairPermutations [_] = [] pairPermutations [x, y] = pure (x, y) -pairPermutations (x:xs) = map (\y -> (x, y)) xs ++ pairPermutations xs +pairPermutations (x:xs) = map (x,) xs ++ pairPermutations xs type Position = (Int, Int) type Antenna = (Char, Position)