Guillaume Martres - Polymorphic Function Types in Scala 3

  Рет қаралды 924

Scala Days Conferences

Scala Days Conferences

Күн бұрын

Methods in Scala are not first-class values: they cannot be passed around, only called. This is not a fundamental limitation since it’s always possible to wrap a method in a class and create an instance of this class (the wrapped method is usually called ““apply”” since Scala will automatically rewrite calls like ““f(x)”” to ““f.apply(x)”” if necessary). But requiring users to create a new class for every kind of method they wish to wrap in a value would be inconvenient and hard to abstract over, so the language comes built-in with scala.FunctionN classes that each contain an apply method with N parameters, combined with some syntactic sugar and special typing rules this lets us conveniently represent functions.
However, Scala methods support a rich set of features that are not expressible with the traditional FunctionN classes: they can have type parameters, dependent parameters, contextual parameters, etc. Thankfully, most of these limitations have now been lifted in Scala 3, in each case the trick was to find a type to abstract over these functions.1 2 3
In this talk we will take a deep dive into polymorphic function types which let us define functions with type parameters.
We will show how to use them, what they’re good for, how they interact with other language features and how they’re implemented.
We will also discuss recent improvements made in the compiler to make them more pleasant to use, and possible future improvements.
1. docs.scala-lan...
2. docs.scala-lan...
3. docs.scala-lan...

Пікірлер: 4
@JoanGoyeau
@JoanGoyeau 4 ай бұрын
Really cool. Thanks Guillaume
@MrDejvidkit
@MrDejvidkit 10 ай бұрын
This really puts my thinking about polymorphic functions to another level. That etha expansion on polymorphic functions looks fantastic.
@alex.boisvert
@alex.boisvert 11 ай бұрын
Thanks Guillaume, great talk on this advanced topic. Excited about the SIP and further improvements to polymorphic function types!
@omarreddam4943
@omarreddam4943 10 ай бұрын
Hah the smile when mentioning we don’t have functions from terms to types… so far.. Maybe Guillaume knows something we don’t? a fully dependently typed scala 4.0 ?
Martin Kučera - Tyqu: Typesafe SQL Queries in Scala
36:57
Scala Days Conferences
Рет қаралды 955
Nicolas Rinaudo - When is an ADT not an ADT?
37:25
Scala Days Conferences
Рет қаралды 1,4 М.
SCHOOLBOY. Мама флексит 🫣👩🏻
00:41
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 7 МЛН
David Amancio Gil Méndez - Diamond Architecture on Scala 3
41:28
Scala Days Conferences
Рет қаралды 1 М.
Taming the context beast - Paweł Marks
53:27
ScalaCon
Рет қаралды 374
Wojciech Mazur - Explaining Different Coroutine Flavours using Scala Native
37:16
Tomas Mikula - When your DSL Needs to Support User-Defined Functions
42:18
Scala Days Conferences
Рет қаралды 526
Paul Matthews - Sounds of Structure - Music Modelling with ADT's
42:26
Scala Days Conferences
Рет қаралды 777
Scala 3 Metaprogramming by Example by Adam Warski
53:48
Ziverge
Рет қаралды 7 М.
Maciej Gorywoda - The State of the IntelliJ Scala Plugin 2023
28:02
Scala Days Conferences
Рет қаралды 785
Jan-Pieter van den Heuvel - Saving Christmas Using Scala
42:34
Scala Days Conferences
Рет қаралды 515