From b1bd83f089437a612afdcbd34f6df68f398c4b4d Mon Sep 17 00:00:00 2001 From: George Thomas Date: Tue, 2 Dec 2025 08:55:32 +0000 Subject: [PATCH] Minor refactor --- app/Main.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Main.hs b/app/Main.hs index 244e334..d31c457 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -23,13 +23,14 @@ puzzleTest :: Puzzle a -> TestTree puzzleTest p = testGroup pt $ ["examples", "real"] <&> \t -> - withResource (maybe (fail "parse failure") pure . p.parse =<< readFile ("inputs/" <> t <> "/" <> pt)) mempty \input -> + withResource (parseFile $ "inputs/" <> t <> "/" <> pt) mempty \input -> testGroup t $ [("1", p.part1), ("2", p.part2)] <&> \(n, pp) -> goldenVsString n ("outputs/" <> t <> "/" <> pt <> "/" <> n) $ BL.fromStrict . encodeUtf8 . pp.solve <$> input where pt = show p.number + parseFile fp = maybe (fail "parse failure") pure . p.parse =<< readFile fp data Puzzle input = Puzzle { number :: Word