haskell: getLine/getContents/readFile/writeFile + 0-arity builtin force (+12 tests, 587/587)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 21s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 21s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -106,7 +106,7 @@ Key mappings:
|
||||
|
||||
### Phase 6 — real IO + Prelude completion
|
||||
- [x] Real `IO` monad backed by `perform`/`resume`
|
||||
- [ ] `putStrLn`, `getLine`, `readFile`, `writeFile`, `print`
|
||||
- [x] `putStrLn`, `getLine`, `readFile`, `writeFile`, `print`
|
||||
- [ ] Full-ish Prelude: `Maybe`, `Either`, `List` functions, `Map`-lite
|
||||
- [ ] Drive scoreboard toward 150+ passing
|
||||
|
||||
@@ -114,6 +114,17 @@ Key mappings:
|
||||
|
||||
_Newest first._
|
||||
|
||||
- **2026-05-06** — Phase 6 `getLine`/`getContents`/`readFile`/`writeFile`. `hk-force`
|
||||
extended: 0-arity builtins (`arity=0` dicts) are called immediately when forced,
|
||||
making `getLine`/`getContents` work naturally as IO actions (no arity-0 application
|
||||
needed — `>>=` forces them and gets the `("IO" value)` result). `getLine` pops
|
||||
from `hk-stdin-lines`; `getContents` drains it joining with `"\n"`; `readFile`
|
||||
reads from `hk-vfs` (dict), errors on missing key; `writeFile` sets `hk-vfs` key.
|
||||
`hk-run-io-with-input` resets both io-lines and stdin then runs. `>>=` and `>>`
|
||||
added to `hk-binop` for infix operator path. Bug caught: `sx_replace_node` on the
|
||||
thunk-force branch accidentally changed `"body"` → `"fn"` (key name); fixed.
|
||||
11 new tests in `tests/io-input.sx`. 587/587 green.
|
||||
|
||||
- **2026-05-06** — Phase 6 real IO monad. `eval.sx`: mutable `hk-io-lines` list
|
||||
buffer; `putStrLn` and `putStr` append the (forced) string arg; `print` appends
|
||||
`hk-show-val` of the arg; all three return `("IO" ("Tuple"))`. `hk-run-io`
|
||||
|
||||
Reference in New Issue
Block a user