From 55e947660720dc8a31b4445bfbf7f9244546f77e Mon Sep 17 00:00:00 2001 From: Steve Dunham Date: Mon, 8 Dec 2025 08:25:01 -0800 Subject: [PATCH] Change Show for List to include brackets --- aoc2024/Day21.newt.golden | 4 ++-- aoc2024/Day21monad.newt.golden | 4 ++-- src/Prelude.newt | 2 +- tests/Possible.newt.fail | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/aoc2024/Day21.newt.golden b/aoc2024/Day21.newt.golden index e740b44..08cb442 100644 --- a/aoc2024/Day21.newt.golden +++ b/aoc2024/Day21.newt.golden @@ -1,8 +1,8 @@ aoc2024/day21/eg.txt -(0, (3, 1)), (1, (2, 0)), (2, (2, 1)), (3, (2, 2)), (4, (1, 0)), (5, (1, 1)), (6, (1, 2)), (7, (0, 0)), (8, (0, 1)), (9, (0, 2)), (A, (3, 2)) +[(0, (3, 1)), (1, (2, 0)), (2, (2, 1)), (3, (2, 2)), (4, (1, 0)), (5, (1, 1)), (6, (1, 2)), (7, (0, 0)), (8, (0, 1)), (9, (0, 2)), (A, (3, 2))] part1 126384 part2 154115708116294 aoc2024/day21/input.txt -(0, (3, 1)), (1, (2, 0)), (2, (2, 1)), (3, (2, 2)), (4, (1, 0)), (5, (1, 1)), (6, (1, 2)), (7, (0, 0)), (8, (0, 1)), (9, (0, 2)), (A, (3, 2)) +[(0, (3, 1)), (1, (2, 0)), (2, (2, 1)), (3, (2, 2)), (4, (1, 0)), (5, (1, 1)), (6, (1, 2)), (7, (0, 0)), (8, (0, 1)), (9, (0, 2)), (A, (3, 2))] part1 248108 part2 303836969158972 diff --git a/aoc2024/Day21monad.newt.golden b/aoc2024/Day21monad.newt.golden index e740b44..08cb442 100644 --- a/aoc2024/Day21monad.newt.golden +++ b/aoc2024/Day21monad.newt.golden @@ -1,8 +1,8 @@ aoc2024/day21/eg.txt -(0, (3, 1)), (1, (2, 0)), (2, (2, 1)), (3, (2, 2)), (4, (1, 0)), (5, (1, 1)), (6, (1, 2)), (7, (0, 0)), (8, (0, 1)), (9, (0, 2)), (A, (3, 2)) +[(0, (3, 1)), (1, (2, 0)), (2, (2, 1)), (3, (2, 2)), (4, (1, 0)), (5, (1, 1)), (6, (1, 2)), (7, (0, 0)), (8, (0, 1)), (9, (0, 2)), (A, (3, 2))] part1 126384 part2 154115708116294 aoc2024/day21/input.txt -(0, (3, 1)), (1, (2, 0)), (2, (2, 1)), (3, (2, 2)), (4, (1, 0)), (5, (1, 1)), (6, (1, 2)), (7, (0, 0)), (8, (0, 1)), (9, (0, 2)), (A, (3, 2)) +[(0, (3, 1)), (1, (2, 0)), (2, (2, 1)), (3, (2, 2)), (4, (1, 0)), (5, (1, 1)), (6, (1, 2)), (7, (0, 0)), (8, (0, 1)), (9, (0, 2)), (A, (3, 2))] part1 248108 part2 303836969158972 diff --git a/src/Prelude.newt b/src/Prelude.newt index 9e88a79..90fa041 100644 --- a/src/Prelude.newt +++ b/src/Prelude.newt @@ -828,7 +828,7 @@ instance ∀ a b. {{Show a}} {{Show b}} → Show (a × b) where show (a,b) = "(" ++ show a ++ ", " ++ show b ++ ")" instance ∀ a. {{Show a}} → Show (List a) where - show xs = joinBy ", " $ map show xs + show xs = "[" ++ (joinBy ", " $ map show xs) ++ "]" -- For now, I'm not having the compiler do this automatically diff --git a/tests/Possible.newt.fail b/tests/Possible.newt.fail index da2b20d..ab1832b 100644 --- a/tests/Possible.newt.fail +++ b/tests/Possible.newt.fail @@ -1,7 +1,7 @@ *** Process tests/Possible.newt module Prelude module Possible -ERROR at tests/Possible.newt:6:5--6:8: possible constructors: Prelude.Z, Prelude.S +ERROR at tests/Possible.newt:6:5--6:8: possible constructors: [Prelude.Z, Prelude.S] foo : Nat → Nat foo ()