haskell: Phase 9 — partial fns proper error messages (head []/tail []/fromJust Nothing) (+5 tests, 64/64)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 1m5s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 1m5s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -128,7 +128,7 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
|
||||
the tag has to live in a string prefix rather than as the head of a list.
|
||||
Catchers use `(index-of e "hk-error: ")` to detect.
|
||||
- [x] `undefined :: a` = `error "Prelude.undefined"`.
|
||||
- [ ] Partial functions emit proper error messages: `head []` →
|
||||
- [x] Partial functions emit proper error messages: `head []` →
|
||||
`"Prelude.head: empty list"`, `tail []` → `"Prelude.tail: empty list"`,
|
||||
`fromJust Nothing` → `"Maybe.fromJust: Nothing"`.
|
||||
- [ ] Top-level `hk-run-io` catches `hk-error` tag and returns it as a tagged
|
||||
@@ -293,6 +293,15 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
|
||||
|
||||
_Newest first._
|
||||
|
||||
**2026-05-07** — Phase 9 partial functions emit proper error messages:
|
||||
- Added empty-list catch clauses to `head`, `tail` in the prelude. Added
|
||||
`fromJust`, `fromMaybe`, `isJust`, `isNothing` (the last three were missing).
|
||||
`fromJust Nothing` raises `"Maybe.fromJust: Nothing"`. Multi-clause dispatch
|
||||
tries the constructor pattern first, then falls through to the empty-list /
|
||||
Nothing error clause.
|
||||
- 5 new tests in `tests/eval.sx`. Suite is 64/64. Verified no regressions in
|
||||
match, stdlib, fib, quicksort, program-maybe.
|
||||
|
||||
**2026-05-07** — Phase 9 `undefined = error "Prelude.undefined"` + lazy CAFs:
|
||||
- Added `undefined = error "Prelude.undefined"` to `hk-prelude-src`. Without
|
||||
any other change this raised at prelude-load time because `hk-bind-decls!`
|
||||
|
||||
Reference in New Issue
Block a user