haskell: Algorithm W type inference + 32 tests (434/434)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 43s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 43s
Full HM inference in lib/haskell/infer.sx: unification, substitution, occurs check, instantiation, generalisation, let-polymorphism. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -91,7 +91,7 @@ Key mappings:
|
||||
- [x] Target: 5/5 classic programs passing
|
||||
|
||||
### Phase 4 — Hindley-Milner inference
|
||||
- [ ] Algorithm W: unification + type schemes + generalisation + instantiation
|
||||
- [x] Algorithm W: unification + type schemes + generalisation + instantiation
|
||||
- [ ] Report type errors with meaningful positions
|
||||
- [ ] Reject untypeable programs that phase 3 was accepting
|
||||
- [ ] Type-sig checking: user writes `f :: Int -> Int`; verify
|
||||
@@ -114,6 +114,18 @@ Key mappings:
|
||||
|
||||
_Newest first._
|
||||
|
||||
- **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,
|
||||
generalisation (let-polymorphism). Algorithm W covers literals, var, con, lambda,
|
||||
multi-param lambda, application, let (simple bind + fun-clause), if, binary ops
|
||||
(desugared to double application), tuples, and list literals. Initial type
|
||||
environment provides monomorphic arithmetic/comparison/boolean ops plus
|
||||
polymorphic list functions (`head`/`tail`/`null`/`length`/`reverse`/`:`).
|
||||
`hk-infer-type` is the public entry point. test.sh updated to load infer.sx.
|
||||
32 new tests in `lib/haskell/tests/infer.sx` cover all node types + let-
|
||||
polymorphism. 434/434 green.
|
||||
|
||||
- **2026-04-25** — `conformance.sh` runner + `scoreboard.json` + `scoreboard.md`.
|
||||
Script runs each classic program's test suite, prints per-program pass/fail,
|
||||
and writes both files. `--check` mode skips writing for CI use.
|
||||
|
||||
Reference in New Issue
Block a user