21 Commits

Author SHA1 Message Date
George Thomas
8442ce8dba Generalise test monoid instance 2026-01-01 13:24:49 +00:00
George Thomas
f7c9297a85 Reuse expensive computation for day 4 extra tests
Ideally we'd similarly add the ability for later tests to use the results of earlier ones. But this would probably require much heavier type family usage.
2025-12-31 01:49:16 +00:00
George Thomas
450d7e5240 Port from Tasty to Sydtest
There are some drawbacks:
- No properly lazy golden tests. This would in principle be nice when e.g. using `pretty-simple`.
- Because tests can be created dynamically, they can't be listed up front without running them. This presumably makes filtering slightly more annoying to use in practice.
- Terminal output is less compact than tasty, both horizontally and vertically. There appears to be no way to change this.
- We end up defining an orphan `Monoid (TestDefM '[] () ())` instance, to avoid changing much downstream code. Note though that this is not strictly necessary, and could potentially be contributed upstream.
- There's a warning about threads in GHCI which we can't seem to disable.
- The license forbids use in commercial projects without sponsoring. Thankfully that doesn't apply here.

Anyway, it's generally very impressive. It simplifies a few things for us, and will particularly help when we come to want to specify dependencies between tests.
2025-12-31 01:49:07 +00:00
George Thomas
415055dcc2 Allow output types to vary for different parts of same day
For now this applies to Haskell only, and it may turn out to be tricky for the Rust implementation.

In practice, the limitation hasn't turned out to be important, and we could even go the other way and use `Integer` everywhere. This does however at least help with debugging, as well as just being conceptually right.

The `nil` and `(/\)` functions are intended to be overloaded to work for other list-like things in a later commit, and from there we will investigate using `OverloadedLists` and `RebindableSyntax` to recover standard list syntax, although there are probably limitations due to `(:)` being special.
2025-12-16 16:15:11 +00:00
George Thomas
6ca7b4eac8 Match digitsToInt to simpler Rust version 2025-12-13 11:24:46 +00:00
George Thomas
cdc54a27aa Solve day 10 part 1 2025-12-11 11:34:36 +00:00
George Thomas
57c1613019 Move output showing to main entry point 2025-12-09 16:57:05 +00:00
George Thomas
6e851d63f0 Show diff for golden test failures 2025-12-09 16:47:12 +00:00
George Thomas
2862457529 Solve day 9 part 2 2025-12-09 13:37:39 +00:00
George Thomas
e85429629f Generalise allUnorderedPairs
Now that it's in the prelude, the desire to remove diagonals is less obvious than it was.
2025-12-09 13:35:54 +00:00
George Thomas
c608e21e26 Solve day 9 part 1 2025-12-09 13:35:54 +00:00
George Thomas
02fbb8c0be Minor refactor 2025-12-09 00:26:22 +00:00
George Thomas
1e3ed16971 Avoid unsafe list indexing 2025-12-09 00:02:54 +00:00
George Thomas
832b85fb7b Solve day 8 part 2 2025-12-08 23:38:48 +00:00
George Thomas
e92cc2f0d3 Minor refactors 2025-12-08 22:59:50 +00:00
George Thomas
d0488726a0 Add argument to parser for disambiguating real data versus examples
This breaks less code than adding it to the solution functions, and is more elegant in a way.
2025-12-08 22:59:50 +00:00
George Thomas
43918c70fa Solve day 8 part 2 2025-12-08 22:59:50 +00:00
George Thomas
b0a191edb9 Solve day 8 part 1 2025-12-08 22:59:50 +00:00
George Thomas
f6f0fc171f Solve day 7 part 1 2025-12-08 22:59:50 +00:00
George Thomas
5539a4bd05 Solve day 6 part 1 2025-12-08 22:59:35 +00:00
George Thomas
371bddf748 Use custom prelude 2025-12-08 12:48:49 +00:00