racket / racket/racket

[Feature Request] Ellipses for Parametric Contracts

Open
#4,979 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Racket
Stars
5.2k
Forks
698
Avg merge
18h 34m
Merged PRs (30d)
5

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files, tests, or entry points are identified in the issue. Begin by locating the implementation and tests for parametric contracts and determine how ellipses could bind arbitrarily many parameters; done means supporting the requested contract form with coverage for the apply example.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.