Skip to content

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

@NoahStoryM

Description

@NoahStoryM

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]

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy