~/talk

Polymorphic Function Types in Scala 3

slides:none on file

Scala 3 adds first-class polymorphic function types, represented as a refinement that injects an apply method so the type system treats them like values (represented as refinement adding an apply method). The compiler erases type parameters and emits a monomorphic JVM shape, inserting casts as needed (erases to monomorphic function with same term arity). Real uses include Tuple.map, generic typeclass derivation, sized lists and contextual callbacks; work includes SIP-49 and a prototype for polymorphic eta-expansion and type-parameter closure inference. Overall, feature compiles and runs, but natural subtyping for poly‑function types is still pending.

AI-written summary · about

  1. 0:00Polymorphic function types intro
  2. 1:16Methods vs functions in Scala
  3. 5:16Why polymorphic types exist
  4. 10:40How polymorphic functions work
  5. 16:47Use cases for polymorphic functions
  6. 21:06Generic programming with polymorphism
  7. 25:26Type safety with contextual polymorphism
  8. 29:48Improving polymorphic function usability
  9. 33:28Type parameter closure inference
  10. 36:40Natural subtyping for polymorphism
  11. 39:15Resources and closing
~/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.