haskell: Phase 9 — undefined in prelude + lazy CAFs (+2 tests, 59/59)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 1m7s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 1m7s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -127,7 +127,7 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
|
||||
`"Unhandled exception: <serialized>"` before any user handler sees them, so
|
||||
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.
|
||||
- [ ] `undefined :: a` = `error "Prelude.undefined"`.
|
||||
- [x] `undefined :: a` = `error "Prelude.undefined"`.
|
||||
- [ ] Partial functions emit proper error messages: `head []` →
|
||||
`"Prelude.head: empty list"`, `tail []` → `"Prelude.tail: empty list"`,
|
||||
`fromJust Nothing` → `"Maybe.fromJust: Nothing"`.
|
||||
@@ -293,6 +293,18 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
|
||||
|
||||
_Newest first._
|
||||
|
||||
**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!`
|
||||
was eagerly evaluating zero-arity definitions (CAFs). Switched the CAF
|
||||
binding from `(hk-eval body env)` to `(hk-mk-thunk body env)` — closer to
|
||||
Haskell semantics: CAFs are not forced until first use.
|
||||
- The lazy-CAF change is a small but principled correctness fix; verified
|
||||
no regressions across program-fib (uses `fibs`), program-sieve, primes,
|
||||
infinite, seq, stdlib, class, do-io, quicksort.
|
||||
- 2 new tests in `tests/eval.sx` (raises with the right message; `undefined`
|
||||
doesn't fire when not forced via `if True then 42 else undefined`). 59/59.
|
||||
|
||||
**2026-05-07** — Phase 9 `error :: String -> a` raises with `hk-error:` prefix:
|
||||
- Pre-existing `error` builtin was raising `"*** Exception: <msg>"` (GHC
|
||||
console convention). Renamed prefix to `"hk-error: "` so the wrap-around
|
||||
|
||||
Reference in New Issue
Block a user