Use consistent naming convention for puzzles
This commit is contained in:
parent
f0c2b8ca02
commit
83b994965d
@ -5,8 +5,8 @@ import Data.Functor
|
|||||||
import Data.Text.Encoding (encodeUtf8)
|
import Data.Text.Encoding (encodeUtf8)
|
||||||
import Data.Text.IO qualified as T
|
import Data.Text.IO qualified as T
|
||||||
import Puzzle
|
import Puzzle
|
||||||
import Puzzles.Day1
|
import Puzzles.Day1 qualified as Day1
|
||||||
import Puzzles.Day2
|
import Puzzles.Day2 qualified as Day2
|
||||||
import Test.Tasty
|
import Test.Tasty
|
||||||
import Test.Tasty.Golden (goldenVsString)
|
import Test.Tasty.Golden (goldenVsString)
|
||||||
import Test.Tasty.Ingredients.ConsoleReporter
|
import Test.Tasty.Ingredients.ConsoleReporter
|
||||||
@ -19,8 +19,8 @@ main =
|
|||||||
. testGroup "tests"
|
. testGroup "tests"
|
||||||
$ ["examples", "real"] <&> \t ->
|
$ ["examples", "real"] <&> \t ->
|
||||||
testGroup t $
|
testGroup t $
|
||||||
[ puzzle1
|
[ Day1.puzzle
|
||||||
, puzzle2
|
, Day2.puzzle
|
||||||
]
|
]
|
||||||
<&> \Puzzle{number, parser, parts} ->
|
<&> \Puzzle{number, parser, parts} ->
|
||||||
let
|
let
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
module Puzzles.Day1 (puzzle1) where
|
module Puzzles.Day1 (puzzle) where
|
||||||
|
|
||||||
import Control.Monad.State
|
import Control.Monad.State
|
||||||
import Data.Bifunctor
|
import Data.Bifunctor
|
||||||
@ -9,8 +9,8 @@ import Text.Megaparsec hiding (Pos)
|
|||||||
import Text.Megaparsec.Char
|
import Text.Megaparsec.Char
|
||||||
import Text.Megaparsec.Char.Lexer qualified as Lex
|
import Text.Megaparsec.Char.Lexer qualified as Lex
|
||||||
|
|
||||||
puzzle1 :: Puzzle
|
puzzle :: Puzzle
|
||||||
puzzle1 =
|
puzzle =
|
||||||
Puzzle
|
Puzzle
|
||||||
{ number = 1
|
{ number = 1
|
||||||
, parser = flip sepEndBy newline $ (,) <$> ((char 'L' $> L) <|> (char 'R' $> R)) <*> (Inc <$> Lex.decimal)
|
, parser = flip sepEndBy newline $ (,) <$> ((char 'L' $> L) <|> (char 'R' $> R)) <*> (Inc <$> Lex.decimal)
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
module Puzzles.Day2 (puzzle2) where
|
module Puzzles.Day2 (puzzle) where
|
||||||
|
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Data.Functor
|
import Data.Functor
|
||||||
@ -10,8 +10,8 @@ import Text.Megaparsec
|
|||||||
import Text.Megaparsec.Char
|
import Text.Megaparsec.Char
|
||||||
import Text.Megaparsec.Char.Lexer qualified as Lex
|
import Text.Megaparsec.Char.Lexer qualified as Lex
|
||||||
|
|
||||||
puzzle2 :: Puzzle
|
puzzle :: Puzzle
|
||||||
puzzle2 =
|
puzzle =
|
||||||
Puzzle
|
Puzzle
|
||||||
{ number = 2
|
{ number = 2
|
||||||
, parser = (<* newline) $ flip sepBy (char ',') $ (,) <$> (Lex.decimal <* char '-') <*> Lex.decimal
|
, parser = (<* newline) $ flip sepBy (char ',') $ (,) <$> (Lex.decimal <* char '-') <*> Lex.decimal
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user