Sessions


Language

Decisions4s: Complicated Conditionals, Higher-Kinded Data and Scala 3Talk

45min

Higher-kinded data is a specialised application of higher-kinded types. It allows to wrap the data in a parametrised effect type (e.g. Option) and reuse the structure between different use cases. I would like to share a bit on that not-so-popular topic and when it might be a good pattern to use. I will also show new features of Scala 3 that makes this kind of type wizardy a much more pleasant experience. The talk is based on experiences with building Decisions4s, scala library for handling complicated conditional logic.


How Functional is Direct-Style?Talk

45min

Direct-style is a recent trend in Scala, with several libraries being developed to support this approach. It’s also the style embraced by OCaml’s Eio and for writing effectful Unison programs.

Is direct-style still functional? Or is it just imperative programming, as some critics argue? Can functional and imperative styles coexist?

We’ll investigate what functional programming is at its core, how it relates to effects and properties such as referential transparency, immutability, idempotence and purity.


Repurposing Scala's Pattern Matching for Deeply Embedded DSLsTalk

45min

Could we reuse Scala’s linguistic features, including variable binding and pattern matching, for describing e.g. durable workflows? In particular, could we obtain a reified description of such workflows, one that we could analyze, serialize, or render graphically? Can we get nested pattern matching on user-defined domain-level ADTs?

Although Scala-Virtualized, an experimental branch of the Scala compiler, gave us means to do so a decade ago, it never made it to the mainline Scala compiler.

In this talk, I’m going to present an alternative technique to repurpose Scala’s pattern matching for deeply embedded DSLs, one that does not require changes to the compiler. Additionally, the presented library solution (from Libretto) comes with translation to point-free representation, which not only avoids the trouble of managing variable bindings, but also makes non-exhaustive pattern matches unrepresentable! And all of that without macros.

The technique is used in the Libretto project for pattern matching on domain-level ADTs. However, I am going to demonstrate it on a simpler, demo DSL for defining durable workflows. Thus, as a bonus, attendees will get an unorthodox approach to durable workflows that’s not based on replaying the event log.


Say goodbye to implicits - contextual abstractions in Scala 3Talk

45min

Have you ever been confused by implicits in Scala? I most certainly have. I struggled to understand them at the beginning of my Scala journey, and to this day I trip over them regularly. It doesn’t help that one keyword can be used for many different things - defining Implicit parameters, implicit conversions, or type class instances. And sometimes it’s so frustrating when your code doesn’t compile because you can’t remember the magical implicit import incantation that is needed (the problem also known as “why does it work fine in that other file, but not here?!”). Scala 3 addresses a lot of the tricky bits in the language to make it clearer and easier to use, and luckily, implicits have also undergone a redesign. Well, to be precise… they’re gone. But in their place, we’re getting language constructs that do one thing and do it well. Please join me in welcoming the new keywords: “given” and “using”, as well as context functions and extension methods. They’re the new kids on the block to define our contextual abstractions, and they’re here to make our code more expressive and easier to understand. Let’s see them in action.


Scala performance: when you should betray your functional programming principlesTalk

45min

Functional programming is great! Immutability and an effects system make programs safer, better, stronger − but not always faster. Today, we’ll gleefully betray our functional principles, and look at how (and when!) you should consider committing such despicable acts as: - making your classes mutable and exposing their internals. - using while-loops instead of for-loops. - preferring arrays to lists or maps.

Of course, I’ll bring a few benchmarks to show the differences. And while we’re there, we’ll talk a bit about benchmarks, performance in general, and why the ‘Big O’ notation is lying to you.


Slow-Auto, Inconvenient-Semi: escaping false dichotomy with sanely-automatic derivationTalk

45min

Are you using one of many type-class based libraries in Scala? Have you ever been forced to understand this “automatic vs semiautomatic” distinction? Did your builds slowed down when you started using the “derivation” thing? Did you ever hate your life when looking for a missing implicit? In this presentation you will learn the source of your issues, and a third way - sanely-automatic derivation which is fast to compile, fast to run, and easy to debug by its users.


There are no trees where we’re going - scary-stuff-less metaprogramming in Scala 3Talk

45min

I shouldn’t have to know what kind of a syntax tree a constructor call desugars into, I just want to transform between two extremely similar data types because the Internet told me I should separate my domain models into layers before I shove them between curly brackets on a socket somewhere.

Are these the kind of thoughts you entertain on a daily basis?

See, you actually CAN have the latter without the former in Scala 3 and with no loss to your compile-time comfort zone no less, so kiss your ASTs goodbye - we won’t be seeing them again.

With that in mind, you can strap in for a gauntlet style run through:

- match types

- mirrors

- typeclass derivation

- ...and the new, exciting and experimental named tuples.

All of that to build a micro-library that does customizable one-liner conversions between similarly shaped data types with some live demos, where we desperately try to make the compiler really mad at us, sprinkled in.

In short, we’ll be exploring the compile-time arsenal that Scala 3 gives us without resorting to dirty tricks.


Welcome to Scala 2.7.7.... in 2024Talk

45min

The presentation is about a practical example on what you will need to deal with in case you are required to work with a legacy Scala application, specifcally, using a 15 years old technology stack.

The session covers a lot of details around build tools from the past, and, strategies to overcome the issues and limitations caused because old artifactory servers were shut down.

It is expected that many people from the audience get surprised about the sbt project structure from the past, and, the complexity to use old applications.


Tools & Ecosystem

Anatomy of ScaladexTalk

45min

In this talk, I will introduce you to Scaladex, an exciting project I began exploring in November 2023. Scaladex represents my first foray into open source contributions, and it has fueled my passion for Scala ever since. I will provide a comprehensive demo of Scaladex, delve into the intricacies behind the application, and share my experiences working on it. Additionally, I’ll highlight my role as a Google Summer of Code 2024 mentor with Scala Center, where I am contributing to two Scaladex-related projects: “Scaladex: New Artifact Page” and “Scaladex: Displaying Information from POM Files”. This session aims to inspire you to consider Scaladex or other projects from Scala Center as your next open source endeavor. Join me to discover the potential and impact of contributing to the Scala community through Scaladex.


Better Scala Builds with the Mill Build ToolTalk

45min

Mill is a Scala build tool that improves upon the SBT toolchain: more performant, easier to understand, and scalable to larger codebases. Unlike most build tools, Mill makes build configuration easy. This talk will explore how Mill works and how your Scala projects can benefit from using Mill today


From Zero to Production Faster Than Your Average Meeting with PillarsTalk

45min

Building production-ready backend services in Scala can be a daunting task, often requiring the integration of multiple libraries and extensive boilerplate code. But what if you could streamline this process and focus entirely on your business logic? Meet Pillars, the Scala library that does just that.

In this dynamic, 45-minute live-coding session, I will demonstrate how Pillars can take you from zero to production in record time. By leveraging Pillars’ integration of well-known libraries, you can bypass the usual complexities of setting up observability (traces, metrics, and logs), database access, API calls, and feature flag management. Pillars handles these essential components out-of-the-box, along with built-in health checks and an admin server, allowing you to concentrate on what truly matters: your business case.

We’ll start from scratch and build a fully functional, production-ready backend service, which will be deployed in a live environment during the session. You’ll see firsthand how Pillars reduces the need for repetitive code, accelerates development, and enhances your ability to deliver robust and scalable services.

Whether you’re a seasoned Scala developer or just getting started, this session will provide you with actionable insights and practical knowledge. Walk away with the confidence and tools to streamline your own projects, making Scala development simpler and more efficient with Pillars.


Joyful & secure publishing to Maven Central!Talk

45min

The Guardian is a hefty open-source contributor, publishing over 40 open-source Scala libraries to Maven Central - some specific to us (like our content-api-scala-client), and others more generally applicable, like play-googleauth or etag-caching. Teams responsible for those libraries need to be able to publish updates at will, but that can be both difficult and dangerous:

- **Difficult**, because every new developer on a team needs release credentials, and those credentials are laborious to set up and manage per developer. Shared-credentials and CI-release can help fix that - but how can we keep those release credentials **secure**, when they’re used by so many projects, with so many third-party dependencies?

- **Dangerous**, because seemingly minor library updates can be startlingly binary incompatible, and humans are just terrible at seeing that coming. Subtle binary incompatibility can sneak past pre-production unit & integration testing, only to completely crash production systems in unpredictable circumstances. There’s no point in releasing new library versions if we’re too scared to update to them! How can we make that safe?

This talk will show how the Guardian’s new GitHub Action release workflow makes the difficult easy, and the dangerous safe. I’ll explain why a single JVM process shouldn’t be responsible for an entire release! We’ll talk about how reducing config - that is, the amount of config per repository - sells the work of adoption, and how we can capitalise on a whole shopping list of improvements (coming from sbt’s versionScheme, sbt-version-policy, and more) whose benefit–cost ratios greatly improve when you’re applying them collectively at the level of your organisation, rather than one repository at time.

gha-scala-library-release-workflow is a *reusable* GitHub workflow, meaning it can be used by other GitHub organisations - it’s already being used by Scanamo - so if you’re publishing to Maven Central, there’s a good chance it can help you too!


Mill builds in Scala 3, a migration storyTalk

45min

Mill is a popular build tool used in Scala projects, where build definitions are written in a dialect of Scala. As of July 2023 it only supports Scala 2 libraries and syntax. I am working until November on porting Mill to Scala 3, so that build definitions will benefit from the latest Scala 3 features. I should have made enough progress by November to talk about the various challenges.


Tools for Scala StartupsTalk

45min

Scala is an underrated language for full-stack applications. A Scala developer should be able to launch a startup quickly, but how?

In this talk, I will show the tools and techniques for building full-stack products in Scala, how to deploy and maintain them, and how to ship quickly and safely.

I will share

- the tools a Scala startup needs

- sets of libraries that work well in a full-stack setting

- how to build, deploy and self-host applications without - headaches or complications

- how to ship code and iterate products quickly

- how to integrate crucially important but often neglected parts, - such as payment systems

- product owner life outside Scala


Building Robust Applications with Kyo: A Hands-on IntroductionShort

30min

In this hands-on workshop, participants will dive deep into Kyo, the innovative Algebraic Effect library for Scala. We’ll start by exploring the fundamentals of algebraic effects and how they improve application development. Then, we’ll guide attendees through building a real-world application using Kyo, demonstrating its intuitive API and powerful capabilities. By the end of the session, participants will have practical experience in leveraging Kyo for building high-performance, scalable backend services. They’ll understand how to use Kyo’s pure functional approach to create more maintainable and robust code without sacrificing readability or ease of use.

Participants should have basic Scala knowledge and bring a laptop with a Scala development environment set up. We’ll provide a GitHub repository with starter code and exercises to ensure a smooth, hands-on learning experience.


Algebra

Calculating is funnier than guessingTalk

45min

We’ve all written functional interpreters. They are easy to write—one usually proceeds by structural induction on the datatype. There’s almost no opportunity for errors. But, interpreters can be slow and fragile. One remedy is to write a compiler that turns syntax into a machine language, and a virtual machine to execute a script written in that language. The thought of writing a compiler may conjure up the two-steps process to draw an owl in your mind, a sort of magical manifestation that only a select few are capable of, who have been passed down the location of the little black notebook with all the secret tricks. But I’m here to tell you there is no black notebook, and writing compilers is not so much about guessing as much as it is about calculating via a rigorous step by step process.

In this talk I will start by dusting off your knowledge of equational reasoning and structural induction. I’ll start by showing how to define a denotational semantics for a simple expression language Expr of booleans. That will be done by writing an evaluation interpreter that brings an expression to its boolean value. Then I will show you how to prove that negation is an involution. Past that point, we are ready to attack the cool stuff and proceed to the derivation of a compiler, a machine language and a stack machine for Expr. This will be a nice refresher on equational reasoning by starting from a correctness equation, deriving each case starting from the left side of the equation and proceed step by step to arrive at the right side of the equation.

Expr is very simple though, in real life we seldom face such simplistic cases. To dispel any doubt, we’ll tackle a more ambitious case in the name of the ZPure datatype from the zio-prelude library.


Computer algebra in ScalaTalk

45min

The Scala Algebra System (ScAS) is a research project devised to explore how one could use a general purpose, statically typed language such as Scala for computerized mathematics. It is at the same time a computer algebra library and a scripting interface, written with itself. As a library, it is based on a typeclass hierarchy of algebraic structures. As an interface, it comes as a Scala DSL for computer algebra, using extension methods and implicit conversions to provide a natural mathematical notation.


Profunctors pour le fun et le profitTalk

45min

Surprise 👀


Recognizing regular patterns in heterogeneous sequencesTalk

45min

Run-time type-based reflection is a powerful tool which is used to solve certain problems which are out of reach to purely statically typed programming languages. The JVM-based implementation Scala allows a running program to maker certain type-based decisions which cannot be made at compile time. Notably, pattern matching and dynamic method dispatch allow the running Scala program to make run-time decisions based on characteristics of input data, the type of which cannot be known at compile time.

In this expose, we present yet another kind of run-time based type decision which allows us to arbitrate among various regular patterns in otherwise untyped data. We call these patterns RTEs (regular type expressions).

The Scala type system allows us to specify sequences such as Seq[Int] or Seq[String], i.e., homogeneous sequences of elements of a specified type. We would additionally like to specify sequences of heterogeneous but regular types. Regular types cannot be statically supported by the Scala type system. However, we have implemented this abstraction the help of run-time reflection.

We assume the audience to already be familiar with string-based regular expressions (REs). REs are used to distinguish strings which follow a regular pattern such as $a(a|b)^*b$, the set of strings beginning with the character a, ending with b, and with zero or more a or b (or both) characters falling in between. We generalize this familiar concept to define expressions which specify a sequence beginning with an integer, ending with a string, and with zero or more integers or strings (or both) falling in between.

`val Int:Rte = Singleton(classOf[Int])`

`val String:Rte = Singleton(classOf[String])`

val r:Rte = Int ++ (Int | String).* ++ String

The implementation of Regular Type Expressions (RTEs) in Scala involves several libraries.

1) genus: Embed a Simple type system (SETS) into Scala’s run-time. genus adds intersection, union, and complement types to Scala (2.13), as well an singleton and predicate types.

2) rte: Define an ADT-like class hierarchy atop SETS to define a set of operators for regular-expression in terms of types. We say ADT-like, because of limitations in the Scala compiler, we cannot implement a actual sealed ADT.

3) xymbolyco: Construct deterministic finite automata, Dfa, from the regular type expressions. This library manipulates DFAs with operations such as minimize, intersection, union, xor, and extract-rte.

The run-time flow consists of:

4) Instantiating an instance of the ADT Rte, 5) Building a Dfa from a given Rte 6) Simulating the Dfa given a sequence, Seq[Any].

There are several questions addressing practical concerns such as performance and memory consumption. Additionally, there are many theoretical questions which investigate the limitations of the generalization from classical character based regular expressions to regular type expressions. Some of these concerns include habitation and vacuity checks (given an Rte, can we determine whether all or no sequence will match). Given two types (in the SETS sense) determine whether one is a subtype of the other, and whether either is empty. Subtype determination is important for guaranteeing that finite automata be deterministic. Unfortunately, the subtype relation cannot always be determined (for several interesting theoretical reasons). We present a clever procedure for DFA construction which is guaranteed to be deterministic, even when the subtype relation cannot be determined.

We expect some audience members will find this abstraction thought-provoking. However, we fully suspect others will find the concept objectionable as in many cases we are fighting to undo some of the guarantees which the Scala compiler endeavors to provide.

The project is available here


Web

Embracing Failure: Web Development with Scala learning pathTalk

45min

Learning web development through courses and books often leaves us unprepared for real-world challenges. Missing configurations, absent tests, version mismatches, and poor documentation are common hurdles that aren’t covered in simplified examples. This talk shares my journey of developing web applications with Scala, highlighting common pitfalls.

Switching from big data to web development presents its own challenges. With many stacks and frameworks available, finding one that allows a quick start and aligns with existing expertise can be difficult. I’ll discuss my experiences with the TypeLevel stack, including Doobie, Http4s, and Cats Effect for the backend, and ScalaJS and Tyrian for the frontend.

A case study on creating a library management system for the Franco-Ukrainian Toloka Association will illustrate the importance of good documentation, practical application, and learning through mistakes. Although focused on Scala, the principles and challenges discussed are relevant across various technologies. Attendees will gain a realistic perspective on the challenges of functional programming in web development and strategies to overcome them.


Full Stack Scala, the easy wayTalk

45min

It is easy and fun to develop a full stack application, strongly inspired from Rock The JVM incredible ZIO rite of passage this talk leverages: * Scala 3 and ZIO both Server and Client side. * Laminar UI framework * Quill as data access layer. * Tapir or ZIO RPC API call * ScalablyTyped binding generation

All set up in 10 seconds.


Quickly developing complex web UIs with the FastScala frameworkShort

30min

The FastScala web framework is based on anonymous and secure callbacks from the client-side to the server-side. This allows you to build your app almost entirely in Scala, leveraging the type-safety of the language to build increasingly more complex components which allow you to implement complex interfaces quickly with a few lines of code: forms/tables/modals/etc. I’ll present the framework, its basic foundational concepts, demo what it can do, give examples of building reusable web components with this approach, discuss security, performance, scalability, and to which situations is this approach best suited.


Data

Optimizing Data Transfer Kafka to BQ: let's use Scala to make it customTalk

45min

I will explore how our team developed a custom solution to address the escalating data and cost challenges of traditional cloud services in our data pipeline. Initially, we used Dataflow to move 2 billion daily events from Kafka to BigQuery, but rising costs prompted a shift to a more sustainable model. I will describe our transition to a two-part custom application that stages data in GCP cloud storage before loading it into BigQuery, and highlight how Scala’s features and the ZIO ecosystem contributed significantly to the performance and reliability of this application.


Plowing Postgres and Unearthing Hidden GemsTalk

45min

It is time to ask more from your database !

PostgreSQL is one of the most feature-complete and well known database management system. It is also one of the piece of technology developers like the most as well as a role model for many open source projects. And yet, some of its most beautiful gems are easy to miss.

We are going to dive into its enormous and excellent feature set and see how they can lead to more robust and efficient systems.

Join to learn more about applying functional principle to schema modeling and have rock-solid guarantee on your data, designing efficient indices using exotic data types, using SQL as the full-featured functional-relational language it really is and simplifying your applicative code, and many more tips and trick to make your database experience better !


Scala & Friends

Beyond the Basics of LSP: Advanced IDE services for OCamlTalk

45min

LSP has greatly standardised the behaviour of IDEs, in a good direction: we can provide, de-facto, decent language support in editors supporting LSP. But it also imposes a standardisation that often assumes that all languages behave like TypeScript. In this presentation, I'll introduce you to Merlin, the IDE service library for OCaml, and cover the custom features (via code-action and custom-request) that enhance the OCaml development experience (covering expression destructuring, expression construction, search by types (à la hoogle, directly in the IDE), type enclosures etc.). The aim of the presentation was to show how to go beyond the default features offered by LSP and offer a development experience adapted to a more expressive language.


Kuzh: Zero-Knowledge Voting in Scala and RustTalk

45min

Anonymous electronic voting is a fascinating subject on many aspects. A well-designed voting procedure is the cornerstone of every democracy. It must provide ballot confidentiality, coercion resistance, double vote prevention, verifiability and ideally no authority or trusted party. In this talk I’ll present Kuzh, a web application implementing distributed anonymous voting through onion routing and zero-knowledge proofs. The first implementation was done in Scala and it was later implemented again in Rust. I’ll use these two implementation to compare Scala and Rust on many levels. During the talk, the audience will be invited to ask questions anonymously ;)

I’ll start by presenting the challenges of anonymous electronic voting and the tools that cryptography gives us to reach our goal. The second part will deep into the implementations, both in Rust and Scala. Finally I’ll conclude by comparing how different it was to develop Kuzh in Scala and Rust, what was easy or difficult in both languages.