Skip to content

stdlib/http.md: the type names it uses cannot be written in user code #3

Description

@O6lvl4

Found in a per-page audit.

The whole signature column of stdlib/http.md is written in terms of Request and Response. Neither name exists:

effect fn h(req: Request) -> Response = ...        // error[E029]: unknown type 'Request'
effect fn h(req: HttpRequest) -> HttpResponse = ... // error[E029] as well

The implementation types are HttpRequest / HttpResponse, and neither spelling is writable by a user program — both are rejected as unknown types. The practical consequence is that a named handler function is impossible; the only form that compiles is an unannotated inline lambda:

http.serve(3000, (req) => http.response(200, "ok"))

That is a significant usability fact the page does not mention.

Other findings on the same page:

  • http.serve signature is wrong: documented as (Int, (Unknown) -> Unknown) -> Unit. Unknown is not a type. Actual: (Int, (HttpRequest) -> HttpResponse) -> Unit.
  • The with_headers example does not parse — Almide has no map literal:
    http.with_headers(200, body, {"Content-Type": "text/html"})
    // error: Expected expression … (got Colon ':')
    
    Working form: map.set(map.new(), "Content-Type", "text/html").
  • Missing function: url_decode(String) -> String (pure, works).

Whether the fix is documentation-only or needs the compiler to expose HttpRequest/HttpResponse as nameable types is worth deciding first — the page cannot be made both accurate and useful while the types stay unwritable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions