rescript-lang / rescript-lang/rescript-lang.org

Document co / contravariance (`<+a>`, `<-a>`)

Open
#149 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted manual
Dominant language
MDX
Stars
1.9k
Forks
260
Avg merge
3d 9h
Merged PRs (30d)
17

Description

This one is definitely an advanced topic.

  • What does + and - mean?
  • What syntax constructs are possible? (type, function, etc.)
  • What practical use-cases does it have / Why do we need it?

Things to avoid:

  • Complex / too scientific wording
  • Too generic examples without practical context

Hints:

  • We use a covariant type in Js.Promise.t (see it here)

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

Start with the linked Js.Promise.t definition in jscomp/others/js_promise.ml, especially around line 32, then research the language's variance syntax and supported constructs. Documentation is done when it explains + and -, covers practical type and function use cases, and uses accessible examples without overly scientific wording.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.