X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=advent03.hs;h=e97dd664a66de32d13ac34d262e37430105121be;hb=ef96d1a9007791a22f857e9c88fa462e093ce7fd;hp=3a6357d9d08fa30b06f3311023fbe4e194685e67;hpb=fe0d18e8121a92134fc0e5be38672e8808863ba8;p=advent-of-code-16.git

diff --git a/advent03.hs b/advent03.hs
index 3a6357d..e97dd66 100644
--- a/advent03.hs
+++ b/advent03.hs
@@ -1,5 +1,7 @@
-import Data.List
-import Data.List.Split
+module Main(main) where
+
+import Data.List (transpose, sort)
+import Data.List.Split (splitOn, chunksOf)
 
 type Triple = [Integer]
 
@@ -23,7 +25,9 @@ part2 triangles = do
 parseLine :: String -> Triple
 parseLine = map (read) . filter (not . null) . splitOn " "
 
+validTriangle :: Triple -> Bool
 validTriangle triple = sortedTriple!!0 + sortedTriple!!1 > sortedTriple!!2
     where sortedTriple = sort triple
 
-byColumns triangles = chunksOf 3 $ concat $ transpose triangles
+byColumns :: [[Integer]] -> [Triple]
+byColumns = chunksOf 3 . concat . transpose