Skip to content
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

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

Open
ryyppy opened this issue Jan 1, 2021 · 3 comments
Open

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

ryyppy opened this issue Jan 1, 2021 · 3 comments
Labels
help wanted Extra attention is needed manual

Comments

@ryyppy
Copy link
Member

ryyppy commented Jan 1, 2021

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)
@ryyppy ryyppy added the manual label Jan 1, 2021
@ryyppy ryyppy changed the title Document contra / covariance (<+a>, <-a>) Document co / contravariance (<+a>, <-a>) Jan 1, 2021
@ryyppy ryyppy added the help wanted Extra attention is needed label Jan 1, 2021
@ryyppy
Copy link
Member Author

ryyppy commented Jan 1, 2021

Probably also related to subtyping (#150)

@tom-sherman
Copy link

I found that the tour of scala has a great introduction to variance: https://docs.scala-lang.org/tour/variances.html

@aganoza
Copy link

aganoza commented May 18, 2021

Flow documentation also has good examples https://flow.org/en/docs/lang/variance/

imagen
imagen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed manual
Projects
None yet
Development

No branches or pull requests

3 participants