haskell: Phase 10 — toInteger/fromInteger verified as prelude identities (+4 tests, 18/18)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 55s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 55s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -98,4 +98,24 @@
|
||||
(hk-as-list (hk-deep-force (hk-run "main = map fromIntegral [1,2,3]")))
|
||||
(list 1 2 3))
|
||||
|
||||
(hk-test
|
||||
"toInteger 100 = 100 (identity)"
|
||||
(hk-deep-force (hk-run "main = toInteger 100"))
|
||||
100)
|
||||
|
||||
(hk-test
|
||||
"fromInteger 7 = 7 (identity)"
|
||||
(hk-deep-force (hk-run "main = fromInteger 7"))
|
||||
7)
|
||||
|
||||
(hk-test
|
||||
"toInteger / fromInteger round-trip"
|
||||
(hk-deep-force (hk-run "main = fromInteger (toInteger 42)"))
|
||||
42)
|
||||
|
||||
(hk-test
|
||||
"toInteger preserves negative"
|
||||
(hk-deep-force (hk-run "main = toInteger (negate 13)"))
|
||||
-13)
|
||||
|
||||
{:fails hk-test-fails :pass hk-test-pass :fail hk-test-fail}
|
||||
|
||||
@@ -152,7 +152,8 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
|
||||
(all numbers share one SX type); register as a builtin no-op with the correct
|
||||
typeclass signature. _Already in `hk-prelude-src` as `fromIntegral x = x`;
|
||||
verified with new tests in `numerics.sx`._
|
||||
- [ ] `toInteger`, `fromInteger` — same treatment.
|
||||
- [x] `toInteger`, `fromInteger` — same treatment. _Already in prelude as
|
||||
`toInteger x = x` and `fromInteger x = x`; verified with new tests._
|
||||
- [ ] Float/Double literals round-trip through `hk-show-val`:
|
||||
`show 3.14 = "3.14"`, `show 1.0e10 = "1.0e10"`.
|
||||
- [ ] Math builtins: `sqrt`, `floor`, `ceiling`, `round`, `truncate` — call
|
||||
@@ -296,6 +297,11 @@ No OCaml changes are needed. The view type is fully representable as an SX dict.
|
||||
|
||||
_Newest first._
|
||||
|
||||
**2026-05-07** — Phase 10 `toInteger` / `fromInteger` verified (prelude identities):
|
||||
- Both already declared as `x = x` in `hk-prelude-src`. Added 4 tests in
|
||||
`numerics.sx` (positive, identity round-trip, negative-via-negate, fromInteger
|
||||
smoke). Suite now 18/18.
|
||||
|
||||
**2026-05-07** — Phase 10 `fromIntegral` verified (already an identity in prelude):
|
||||
- Pre-existing `fromIntegral x = x` line in `hk-prelude-src` was already
|
||||
correct — all numbers share one SX type, so the identity implementation is
|
||||
|
||||
Reference in New Issue
Block a user