HS: do→let/it chaining, single-IO fetch, fetch URL parser, IO mock
Compiler: do-blocks now compile to (let ((it cmd1)) (let ((it cmd2)) ...)) instead of (do cmd1 cmd2 ...). This chains the `it` variable through command sequences, enabling `fetch X then put it into me` pattern. Each command's result is bound to `it` for the next command. Runtime: hs-fetch simplified to single perform (io-fetch url format) instead of two-stage io-fetch + io-parse-text/json. Parser: fetch URL /path handled by reading /+ident tokens. Default fetch format changed to "text" (was "json"). Test runner: mock fetch routes with format-specific responses. io-fetch handler returns content directly based on format param. Fetch tests still need IO suspension to chain through let continuations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -285,13 +285,7 @@
|
||||
hs-fetch
|
||||
(fn
|
||||
(url format)
|
||||
(let
|
||||
((response (perform (list (quote io-fetch) url))))
|
||||
(cond
|
||||
((= format "json") (perform (list (quote io-parse-json) response)))
|
||||
((= format "text") (perform (list (quote io-parse-text) response)))
|
||||
((= format "html") (perform (list (quote io-parse-html) response)))
|
||||
(true response)))))
|
||||
(perform (list "io-fetch" url (if format format "text")))))
|
||||
|
||||
(define
|
||||
hs-coerce
|
||||
|
||||
Reference in New Issue
Block a user