soma.cell

Web responses builtins

5 builtins of Soma 3.2.4 in the category Web responses, with their exact signatures, as soma describe --builtins --json prints them.

html

html(body) -> Response | html(status: Int, body, header_key, header_value, ...) -> Response

text/html response; auto-injects HTMX on full pages that use hx- attributes.

deterministic · replay: pure

Used in verified programs:

  • web/contact_form, line 39: {method: "GET", path: "/"} -> html("<form method='post' action='/contact'><input name='name'><input name='email'><textarea name='mes
  • web/counter_api, line 52: {method: "GET", path: "/"} -> html("<h1>Counter</h1><p>POST /inc /dec /reset, GET /value</p>")
  • web/guestbook, line 47: {method: "GET", path: "/"} -> html(_render())
  • web/site_router, line 26: {method: "GET", path: "/"} -> html(_page("Home", "<h1>Welcome</h1><p>A site in Soma.</p>"))

response

response(status: Int, body, header_key, header_value, ...) -> Response

Response with explicit status, body, and optional headers.

deterministic · replay: pure

Used in verified programs:

redirect

redirect(url: String) -> Response

302 redirect to url.

deterministic · replay: pure

Used in verified programs:

sse

sse(streams...) -> Response

Open a Server-Sent-Events connection that receives only the named streams (no name: every stream).

deterministic · replay: pure

publish

publish(stream: String, data) -> ()

Push data to a runtime-chosen SSE stream name on the event bus.

deterministic · replay: pure