Skip to content

<HttpServer> effect — verified HTTP request handling #305

@aallan

Description

@aallan

Summary

Add an <HttpServer> algebraic effect that allows Vera programs to handle incoming HTTP requests with verified contracts.

Design

Vera's algebraic effect system maps naturally to HTTP server patterns. An incoming request is an effect operation; the handler provides the routing and response logic:

effect HttpServer {
  op on_request(HttpRequest -> HttpResponse);
}

handle[HttpServer] {
  on_request(@HttpRequest) -> {
    // route, process, build response
    resume(response)
  }
} in {
  serve(8080)
}

Contracts on handler operations can verify:

  • Response status codes match expected patterns
  • Required headers are present
  • Response body conforms to a schema

Dependencies

Implementation notes

  • Maps to WASI wasi:http/incoming-handler interface
  • The handle[HttpServer] pattern models request routing as an effect handler
  • Long-running server loop requires the Diverge effect (already supported)
  • Real concurrency requires WASI 0.3 / handle[Async] (handle[Async] — custom scheduling strategies #270)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions