~/talk

Contravariance: intuition building from first principles

Talkat Scala.IO 2024 - Nantes · 2024-02-15..02-16· [typescript]
links:none on file
slides:none on file

Builds intuition from first principles by showing exact substitutability rules, changing a type parameter’s variance to make code compile, and demonstrating which direction substitution must go. Works through a concrete Animal hierarchy with Rescue/Clinic typeclasses to show why Rescue is covariant (+) and Clinic contravariant (−), then tests the idea with JsonEncoder/JsonDecoder and real Scala compiler behavior, and points to common real-world occurrences (codecs, Show, function inputs).

AI-written summary · about

  1. 0:00Introduction and motivation
  2. 2:56Prerequisites
  3. 4:52Covariance and subtyping
  4. 12:26Understanding contravariance
  5. 17:04Practical use cases
  6. 23:46Why contravariance is hard
  7. 29:17Conclusion and Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.