haskell: reject untypeable programs — hk-typecheck + hk-run-typed (+9 tests, 464/464)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 46s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 46s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -93,7 +93,7 @@ Key mappings:
|
||||
### Phase 4 — Hindley-Milner inference
|
||||
- [x] Algorithm W: unification + type schemes + generalisation + instantiation
|
||||
- [x] Report type errors with meaningful positions
|
||||
- [ ] Reject untypeable programs that phase 3 was accepting
|
||||
- [x] Reject untypeable programs that phase 3 was accepting
|
||||
- [ ] Type-sig checking: user writes `f :: Int -> Int`; verify
|
||||
- [ ] Let-polymorphism
|
||||
- [ ] Unit tests: inference for 50+ expressions
|
||||
@@ -114,6 +114,17 @@ Key mappings:
|
||||
|
||||
_Newest first._
|
||||
|
||||
- **2026-05-05** — Phase 4 reject untypeable programs. `hk-typecheck` runs
|
||||
`hk-infer-prog` on a program AST and raises the first type error found.
|
||||
`hk-run-typed` is a drop-in for `hk-run` that gates evaluation on a
|
||||
successful type check. `hk-infer-decl` now returns a 4th element (raw type
|
||||
value); `hk-infer-prog` propagates inferred types into the running type env
|
||||
so multi-function programs (`f x = x+1\ng y = f y+2`) infer correctly.
|
||||
test.sh extended to load infer.sx for `*typecheck*` files.
|
||||
9 new tests in `tests/typecheck.sx`: 4 valid programs pass through, 5
|
||||
invalid programs are rejected (Int+Bool, non-Bool if condition, unbound var,
|
||||
apply non-function). 464/464 green.
|
||||
|
||||
- **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
|
||||
|
||||
Reference in New Issue
Block a user