From 83b994965da7176030933e10898d8246ca6ddad2 Mon Sep 17 00:00:00 2001 From: George Thomas Date: Tue, 2 Dec 2025 15:22:21 +0000 Subject: [PATCH] Use consistent naming convention for puzzles --- haskell/Main.hs | 8 ++++---- haskell/Puzzles/Day1.hs | 6 +++--- haskell/Puzzles/Day2.hs | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/haskell/Main.hs b/haskell/Main.hs index 2260f1b..80c2d48 100644 --- a/haskell/Main.hs +++ b/haskell/Main.hs @@ -5,8 +5,8 @@ import Data.Functor import Data.Text.Encoding (encodeUtf8) import Data.Text.IO qualified as T import Puzzle -import Puzzles.Day1 -import Puzzles.Day2 +import Puzzles.Day1 qualified as Day1 +import Puzzles.Day2 qualified as Day2 import Test.Tasty import Test.Tasty.Golden (goldenVsString) import Test.Tasty.Ingredients.ConsoleReporter @@ -19,8 +19,8 @@ main = . testGroup "tests" $ ["examples", "real"] <&> \t -> testGroup t $ - [ puzzle1 - , puzzle2 + [ Day1.puzzle + , Day2.puzzle ] <&> \Puzzle{number, parser, parts} -> let diff --git a/haskell/Puzzles/Day1.hs b/haskell/Puzzles/Day1.hs index ca1829d..e79b886 100644 --- a/haskell/Puzzles/Day1.hs +++ b/haskell/Puzzles/Day1.hs @@ -1,4 +1,4 @@ -module Puzzles.Day1 (puzzle1) where +module Puzzles.Day1 (puzzle) where import Control.Monad.State import Data.Bifunctor @@ -9,8 +9,8 @@ import Text.Megaparsec hiding (Pos) import Text.Megaparsec.Char import Text.Megaparsec.Char.Lexer qualified as Lex -puzzle1 :: Puzzle -puzzle1 = +puzzle :: Puzzle +puzzle = Puzzle { number = 1 , parser = flip sepEndBy newline $ (,) <$> ((char 'L' $> L) <|> (char 'R' $> R)) <*> (Inc <$> Lex.decimal) diff --git a/haskell/Puzzles/Day2.hs b/haskell/Puzzles/Day2.hs index 33e3351..1026180 100644 --- a/haskell/Puzzles/Day2.hs +++ b/haskell/Puzzles/Day2.hs @@ -1,4 +1,4 @@ -module Puzzles.Day2 (puzzle2) where +module Puzzles.Day2 (puzzle) where import Control.Monad import Data.Functor @@ -10,8 +10,8 @@ import Text.Megaparsec import Text.Megaparsec.Char import Text.Megaparsec.Char.Lexer qualified as Lex -puzzle2 :: Puzzle -puzzle2 = +puzzle :: Puzzle +puzzle = Puzzle { number = 2 , parser = (<* newline) $ flip sepBy (char ',') $ (,) <$> (Lex.decimal <* char '-') <*> Lex.decimal