haskell: let-polymorphism tests — id/const/nested/twice at multiple types (+6 tests, 476/476)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 47s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-05 23:26:01 +00:00
parent d8f3f8c3b2
commit 622c0851ce
2 changed files with 21 additions and 1 deletions

View File

@@ -95,7 +95,7 @@ Key mappings:
- [x] Report type errors with meaningful positions
- [x] Reject untypeable programs that phase 3 was accepting
- [x] Type-sig checking: user writes `f :: Int -> Int`; verify
- [ ] Let-polymorphism
- [x] Let-polymorphism
- [ ] Unit tests: inference for 50+ expressions
### Phase 5 — typeclasses (dictionary passing)
@@ -114,6 +114,14 @@ Key mappings:
_Newest first._
- **2026-05-05** — Phase 4 let-polymorphism tests. `hk-w-let` already
generalises let-bound types with `hk-generalise` before adding them to the
env, so `id :: ∀a. a→a` is instantiated independently at each use site.
6 new tests in `tests/infer.sx`: identity at Int and Bool separately, identity
tuple `(id 1, id True) → (Int, Bool)`, `const` at two types, nested let with
`f`/`g` sharing the polymorphic binding, and `twice` applied to an arithmetic
lambda. All use the 2-arg `hk-t` form. 476/476 green.
- **2026-05-05** — Phase 4 type-sig checking. `hk-ast-type` converts parsed type
AST nodes (`t-con`/`t-var`/`t-fun`/`t-app`/`t-list`/`t-tuple`) to internal
type values. `hk-collect-tvars` gathers free type variable names. `hk-check-sig`