haskell: class/instance declarations — parse + instance dict eval (+11 tests, 503/503)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 53s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 53s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -99,7 +99,7 @@ Key mappings:
|
||||
- [x] Unit tests: inference for 50+ expressions
|
||||
|
||||
### Phase 5 — typeclasses (dictionary passing)
|
||||
- [ ] `class` / `instance` declarations
|
||||
- [x] `class` / `instance` declarations
|
||||
- [ ] Dictionary-passing elaborator: inserts dict args at call sites
|
||||
- [ ] Standard classes: `Eq`, `Ord`, `Show`, `Num`, `Functor`, `Monad`, `Applicative`
|
||||
- [ ] `deriving (Eq, Show)` for ADTs
|
||||
@@ -114,6 +114,17 @@ Key mappings:
|
||||
|
||||
_Newest first._
|
||||
|
||||
- **2026-05-06** — Phase 5 class/instance declarations. Parser: `hk-parse-class`
|
||||
and `hk-parse-instance` added to the parser closure; `hk-parse-decl` gains
|
||||
arms for `"class"` and `"instance"` reserved words (tokenizer already marks
|
||||
them reserved). `class Eq a where { ... }` → `("class-decl" name tvar decls)`;
|
||||
`instance Eq Int where { ... }` → `("instance-decl" name inst-type decls)`.
|
||||
Eval: `hk-type-ast-str` converts type AST to a string key. `hk-bind-decls!`
|
||||
gains arms for `class-decl` (registers `__class__Name` marker) and
|
||||
`instance-decl` (builds method dict, binds as `dictClassName_TypeStr` in env).
|
||||
11 new tests in `tests/class.sx` covering AST shapes + runtime dict
|
||||
construction. 503/503 green.
|
||||
|
||||
- **2026-05-05** — Phase 4 inference unit tests (50+ expressions). Added 16 new
|
||||
`hk-t` expression tests to `tests/infer.sx`: nested application (`not(not True)`,
|
||||
`negate(negate 1)`), bool/mixed lambdas (`\\x->\\y->x&&y`, `\\x->x==1`),
|
||||
|
||||
Reference in New Issue
Block a user