haskell: classic program fib.hs + source-order top-level binding (+2 tests, 388/388)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
This commit is contained in:
@@ -82,7 +82,7 @@ Key mappings:
|
||||
- [x] `seq`, `deepseq` from Prelude
|
||||
- [x] Do-notation for a stub `IO` monad (just threading, no real side effects yet)
|
||||
- [ ] Classic programs in `lib/haskell/tests/programs/`:
|
||||
- [ ] `fib.hs` — infinite Fibonacci stream
|
||||
- [x] `fib.hs` — infinite Fibonacci stream
|
||||
- [ ] `sieve.hs` — lazy sieve of Eratosthenes
|
||||
- [ ] `quicksort.hs` — naive QS
|
||||
- [ ] `nqueens.hs`
|
||||
@@ -114,6 +114,23 @@ Key mappings:
|
||||
|
||||
_Newest first._
|
||||
|
||||
- **2026-04-25** — First classic program: `fib.hs`. Canonical Haskell
|
||||
source lives at `lib/haskell/tests/programs/fib.hs` (the
|
||||
two-cons-cell self-referential fibs definition plus a hand-rolled
|
||||
`zipPlus`). The runner at `lib/haskell/tests/program-fib.sx`
|
||||
mirrors the source as an SX string (the OCaml server's
|
||||
`read-file` lives in the page-helpers env, not the default load
|
||||
env, so direct file reads from inside `eval` aren't available).
|
||||
Tests: `take 15 myFibs == [0,1,1,2,3,5,8,13,21,34,55,89,144,233,377]`,
|
||||
plus a spot-check that the user-defined `zipPlus` is also
|
||||
reachable. Found and fixed an ordering bug in `hk-bind-decls!`:
|
||||
pass 3 (0-arity body evaluation) iterated `(keys groups)` whose
|
||||
order is implementation-defined, so a top-down program where
|
||||
`result = take 15 myFibs` came after `myFibs = …` could see
|
||||
`myFibs` still bound to its `nil` placeholder. Now group names
|
||||
are tracked in source order via a parallel list and pass 3 walks
|
||||
that. 388/388 green.
|
||||
|
||||
- **2026-04-25** — Phase 3 do-notation + stub IO monad. Added a
|
||||
`hk-desugar-do` pass that follows Haskell 98 §3.14 verbatim:
|
||||
`do { e } = e`, `do { e ; ss } = e >> do { ss }`,
|
||||
|
||||
Reference in New Issue
Block a user