haskell: type error reporting — hk-expr->brief + hk-infer-decl/prog (+21 tests, 455/455)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 48s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 48s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -92,7 +92,7 @@ Key mappings:
|
||||
|
||||
### Phase 4 — Hindley-Milner inference
|
||||
- [x] Algorithm W: unification + type schemes + generalisation + instantiation
|
||||
- [ ] Report type errors with meaningful positions
|
||||
- [x] Report type errors with meaningful positions
|
||||
- [ ] Reject untypeable programs that phase 3 was accepting
|
||||
- [ ] Type-sig checking: user writes `f :: Int -> Int`; verify
|
||||
- [ ] Let-polymorphism
|
||||
@@ -114,6 +114,17 @@ Key mappings:
|
||||
|
||||
_Newest first._
|
||||
|
||||
- **2026-05-05** — Phase 4 type error reporting. `hk-expr->brief` converts any AST
|
||||
node to a short human-readable string for error messages (handles var/con/int/float/
|
||||
str/char/bool/app/op/if/let/lambda/tuple/list/loc). `loc` nodes in `hk-w` delegate
|
||||
to inner expr (position is for outer context). `hk-infer-decl` wraps per-declaration
|
||||
inference in a `guard`, returning `("ok" name type)` or `("err" "in 'name': msg")`
|
||||
tagged results — avoids re-raise infinite loop in SX guard semantics.
|
||||
`hk-infer-prog` runs all declarations and accumulates tagged results. test.sh
|
||||
timeouts raised 120s→240s to accommodate eval.sx (Prelude init ~9s × 20 tests).
|
||||
21 new tests covering brief serializer, error message substrings, loc pass-through,
|
||||
decl inference, and prog-level inference. 455/455 green.
|
||||
|
||||
- **2026-05-05** — Phase 4 Algorithm W (`lib/haskell/infer.sx`). Full
|
||||
Hindley-Milner inference: type constructors (TVar/TCon/TArr/TApp/TTuple/TScheme),
|
||||
substitution (apply/compose/restrict), occurs-check unification, instantiation,
|
||||
|
||||
Reference in New Issue
Block a user