George Thomas
d18166951b
Add mwhen
2026-01-06 23:15:36 +00:00
George Thomas
41f0b8d511
Move some utilities out of Day4.hs
2026-01-06 23:15:03 +00:00
George Thomas
99de1c4d40
Add pretty-simple to prelude
2026-01-06 23:15:03 +00:00
George Thomas
9246597b49
Render ASCII drawing of test tree
2026-01-06 23:14:56 +00:00
George Thomas
ce8cfeca67
Format
2026-01-06 23:14:50 +00:00
George Thomas
ecb7391468
Tidy up main
2026-01-06 23:14:43 +00:00
George Thomas
db41a65453
Avoid forcing puzzle parts outputs
...
Note that:
- This allows us to remove some very temporary hacky code from day 4.
- This includes a refactoring to hide `TestTree`, which could in theory have been made separate.
- This reverts a lot of 1163889.
2026-01-06 23:14:36 +00:00
George Thomas
f213cdb6c3
Minor refactor
2026-01-06 23:14:25 +00:00
George Thomas
cd292d4580
Define withConstrained
2026-01-06 23:14:17 +00:00
George Thomas
83e4489e1f
Add timing information to tests
...
Most of this is concerned with propagating `NFData` constraints.
2026-01-06 23:13:58 +00:00
George Thomas
c1813b4725
Use safe indices for test part lookup
2026-01-05 18:31:34 +00:00
George Thomas
fbc63c221b
Minor refactor
2026-01-05 17:00:21 +00:00
George Thomas
a47e738ec2
Avoid printing empty extra test trees
2026-01-05 17:00:21 +00:00
George Thomas
24a21e3807
Remove heterogenous list length function
2026-01-05 17:00:21 +00:00
George Thomas
7bacf5efc4
Improve error handling in Day 4 extra tests
2026-01-05 17:00:21 +00:00
George Thomas
7ee7b458ce
Format
2026-01-05 17:00:21 +00:00
George Thomas
0dfb8ae7bf
Minor refactor
2026-01-05 17:00:21 +00:00
George Thomas
c3e69cde09
Move to custom test library
2026-01-05 17:00:15 +00:00
George Thomas
ab0a926e24
Move and rephrase comment
2026-01-04 11:16:00 +00:00
George Thomas
f6771a7131
Check day 4 number of frames is as expected
2026-01-04 11:13:39 +00:00
George Thomas
234640fb1a
Add non-parameterised version of HList fold
2026-01-04 02:58:50 +00:00
George Thomas
2180af71ad
Reformat
2026-01-04 02:58:50 +00:00
George Thomas
c4b85eac71
Inline some functions and simplify
2026-01-04 02:58:45 +00:00
George Thomas
8e6179f103
Implement all HList functions in terms of single fold
2026-01-04 02:39:33 +00:00
George Thomas
784e6f2fb2
Generalise puzzle parts type
2026-01-04 02:14:35 +00:00
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
5b24dc1238
Format
2025-12-30 12:03:38 +00:00
George Thomas
2cd2341673
Share frame generation to avoid accidental quadratic complexity
...
Previously each test was computing all frames from scratch.
2025-12-30 12:03:21 +00:00
George Thomas
50e3119aef
Minor refactor
2025-12-23 15:13:25 +00:00
George Thomas
6f5a56acd9
Simplify test result printing
2025-12-23 15:11:52 +00:00
George Thomas
f3247b2e9c
Combine test result printing in to single expression
2025-12-23 13:43:09 +00:00
George Thomas
d80fdfabdd
Avoid printing redundant space
2025-12-23 12:18:05 +00:00
George Thomas
6bc342ba22
Format
2025-12-23 11:31:41 +00:00
George Thomas
1d552fab86
Simplify Rust test newline handling
2025-12-23 11:31:22 +00:00
George Thomas
4c05c068fa
Show duration for long-running Rust tests
...
This roughly matches Tasty's behaviour.
2025-12-23 11:00:32 +00:00
George Thomas
4dc49febe4
Refactor puzzle existential wrapper to take callback
...
This gives us more flexibility to do things between the parts.
2025-12-23 10:59:18 +00:00
George Thomas
9fdd0cc28e
Solve day 4 in Rust
2025-12-22 19:00:09 +00:00
George Thomas
3114920494
Remove redundant constraint
2025-12-22 14:53:22 +00:00
George Thomas
2cf462ad9d
Refactor findMax to more closely match Rust
2025-12-19 16:22:26 +00:00
George Thomas
4a3506a58d
Swap findMax result tuple order
2025-12-19 15:57:11 +00:00
George Thomas
17f4b83fc0
Dereference at call site
2025-12-19 15:57:06 +00:00
George Thomas
73ea25236f
Improve error handling by not panicking in helper function
2025-12-19 15:34:13 +00:00
George Thomas
83e957d5f9
Fix day 3 error case
...
This doesn't actually matter for the input data given, but it ensures we get the right error when the battery list is too short, instead of unwrapping.
2025-12-19 15:14:39 +00:00
George Thomas
2258f965c1
Solve day 3 in Rust
2025-12-19 14:51:36 +00:00
George Thomas
a321ce3f22
Revert "Minor refactor (inlining)"
...
This reverts commit bb57673f8a01e77e42c38bbf5bab60fba8c63098.
Actually, the symmetry with `is_repetition_2` is worth the slight extra verbosity.
2025-12-18 13:01:07 +00:00
George Thomas
bb57673f8a
Minor refactor (inlining)
2025-12-18 13:00:55 +00:00
George Thomas
dc36ba47ff
Avoid unnecessary slice operator
2025-12-17 14:25:10 +00:00
George Thomas
437c2f290d
Use strings for output types in Rust
...
This is a compromise that gets us most of the way towards what we have with the heterogeneous list in Haskell, but without any complex abstractions.
2025-12-16 17:38:53 +00:00