Skip to content

[Feature Request] Adding ... Support to define-type #1446

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

Open
NoahStoryM opened this issue Apr 20, 2025 · 0 comments
Open

[Feature Request] Adding ... Support to define-type #1446

NoahStoryM opened this issue Apr 20, 2025 · 0 comments

Comments

@NoahStoryM
Copy link
Contributor

While TR provides variadic type constructors like Values, U, and Sequenceof, users cannot define their own using define-type. Currently, define-type treats ... as a normal type argument. For instance, attempting to define a variadic My-Union:

> (define-type (My-Union t ...) (U t ...))
> (ann 1 (My-Union 1 0))
- : Integer [more precisely: (U One Zero)]
1
> (ann 1 (My-Union 1))
string:1:7: Type Checker: Error in macro expansion -- wrong number of arguments to type constructor
  type: #<syntax:string:1:8 My-Union>
  expected: 2
  given: 1
  in: (My-Union 1)
 [,bt for context]
> (ann 1 (My-Union 2 1 0))
string:1:7: Type Checker: Error in macro expansion -- wrong number of arguments to type constructor
  type: #<syntax:string:1:8 My-Union>
  expected: 2
  given: 3
  in: (My-Union 2 1 0)
 [,bt for context]
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