r/functionalprogramming • • Jun 04 '26

FP Scala Was an Experiment That Changed Programming - Martin Odersky | The Marco Show

https://youtu.be/Xn_YpUtXWT4
26 Upvotes

25 comments sorted by

View all comments

Show parent comment

3

u/gasche Jun 05 '26

Sure (I referred to "the ML module system work" above), and this was well-understood by Laüfer and Odersky at the stime, that paper is cited on page 2 of their introduction. Then, they write:

This article demonstrates how light-weight abstract data types with first- class implementations can be conveniently integrated into any functional language with a static, polymorphic type system, explicit type variables, and algebraic data type declarations. The key idea of our work is to allow existentially quantified component types in algebraic data types.

For example their second example is as follows:

type KEY = Key of ‘a* (’a -> int)

This really corresponds to the use of existentials in algebraic datatype declarations, which is something that we now understand/describe as one of the two ingredients that form GADTs (the other being the return type instantiation, often described as an implicit type-equality constraint). But GADTs as we understand them did not exist at the time, they emerged from the cross-languages academic discussion at the time, that also produced Scala as an experiment that go wider adoption than most.

3

u/unqualified_redditor Jun 05 '26

Fair enough. You could say Laüfer and Odersky's contribution was to apply existentials to Algebraic Data Types so as to not break hindley-milner inference. Previous work had first class existentials which break decidability.