Giter VIP home page Giter VIP logo

Comments (5)

davegurnell avatar davegurnell commented on July 19, 2024

from scala-with-cats.

ghisvail avatar ghisvail commented on July 19, 2024

If C is a supertype of B , Foo[C] is a subtype of Foo[B]

This the correct definition of contravariance. See essential-scala section 5.6.1 which briefly mentions that contravariance is used for function arguments. The issue should be closed.

from scala-with-cats.

cchphotobox avatar cchphotobox commented on July 19, 2024

Thanks for your response. It seems I can not close this issue (No "Close" button). Sorry for the misunderstanding

from scala-with-cats.

davegurnell avatar davegurnell commented on July 19, 2024

@ccheneson @cchphotobox No worries -- thanks for submitting the issue. You're not the first to mention this. Variance is one of the more esoteric parts of Scala's type system -- it confuses loads of people.

In fact, I think I'll add a note to clarify the situation. If it's being picked up by multiple people, it's worth addressing directly. I'll leave this ticket open as a reminder.

Please do post again if you spot anything else -- every bit of feedback is useful!

from scala-with-cats.

davegurnell avatar davegurnell commented on July 19, 2024

I've made two changes in c7cf137 in an attempt to improve the clarity here:

  • I've changed the wording in the definitions so they both say "subtype" in all places, instead of mixtures of "subtype" and "supertype".

  • I've added some quick examples.

If you have time, please let me know what you think!

from scala-with-cats.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.