Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

require/typed/provide not providing constructors #1366

Open
LiberalArtist opened this issue Mar 27, 2024 · 0 comments
Open

require/typed/provide not providing constructors #1366

LiberalArtist opened this issue Mar 27, 2024 · 0 comments

Comments

@LiberalArtist
Copy link
Contributor

While writing the example code in this Discource reply, I had to create the request value in the untyped submodule because typed/web-server/http did not provide constructors properly. As a more self-contained example, with these definitions:

#lang typed/racket
(require typed/web-server/http)

I get these errors in my interactions:

Welcome to DrRacket, version 8.11.1 [cs].
Language: typed/racket, with debugging; memory limit: 128 MB.
> request
. request: identifier for static struct-type information cannot be used as an expression in: request
> make-request
. Type Checker: missing type for top-level identifier;
 either undefined or missing a type annotation
  identifier: make-request in: make-request
> binding:form
. binding:form: identifier for static struct-type information cannot be used as an expression in: binding:form
> make-binding:form
. Type Checker: missing type for top-level identifier;
 either undefined or missing a type annotation
  identifier: make-binding:form in: make-binding:form

Given these require/typed/provide clauses, I would have expected all four identifiers to be usable as constructors:

[#:struct request
([method : Bytes]
[uri : URL]
[headers/raw : (Listof Header)]
[bindings/raw-promise : (Promise (Listof Binding))]
[post-data/raw : (Option Bytes)]
[host-ip : String]
[host-port : Natural]
[client-ip : String])
#:extra-constructor-name make-request]

[#:struct (binding:file binding)
([filename : Bytes]
[headers : (Listof Header)]
[content : Bytes])
#:extra-constructor-name make-binding:file]

I haven't yet looked into what might be going wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant