racket icon indicating copy to clipboard operation
racket copied to clipboard

[Feature Request] Ellipses for Parametric Contracts

Open Tuplanolla opened this issue 10 months ago • 2 comments

I would like to endow apply and other such procedures with more precise contracts, as seen below.

(define/contract apply/contract
  (parametric->/c (src ... dst)
    (-> (-> src ... dst)
        (list/c src ...)
        dst))
  apply)

Alas, I cannot, because parametric->/c does not support ... or any other mechanism for binding arbitrarily many type parameters. It seems that I have to ignore the domain completely, as shown below.

(define/contract apply/contract
  (parametric->/c (dst)
    (-> (unconstrained-domain-> dst)
        list?
        dst))
  apply)

Is this the best I can do right now? Could support for ellipses be added in the future?

Tuplanolla avatar Apr 22 '24 13:04 Tuplanolla