Use consistent naming convention for puzzles

This commit is contained in:
George Thomas 2025-12-02 15:22:21 +00:00
parent f0c2b8ca02
commit 83b994965d
3 changed files with 10 additions and 10 deletions

View File

@ -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

View File

@ -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)

View File

@ -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