How Libretto, a Scala DSL for concurrent programming, can be used for writing custom stream operators
Libraries for in-memory stream processing, such as FS2, ZIO Streams, Akka Streams, come with a set of built-in stream operators. However, when one needs a custom operator that's not already part of the library, things get complicated.Writing a non-trivial custom stream operator is difficult and error-prone. We are required to leave the safe world of declarative concurrency and enter the lower-level, unsafe world of side effects. We lose the static guarantee that things are wired up properly. We might even find ourselves manually manipulating queues, promises, mutable references, etc., while business logic gets buried in the resulting accidental complexity.
In this talk, I will show how Libretto, a Scala DSL for concurrent programming, can be used for writing custom stream operators. I will also demonstrate Libretto's integration with ZIO Streams.We will see that Libretto lets us focus on business logic rather than on low-level implementation details, thanks to its small but expressive set of built-in operations.
Moreover, stream operators written with Libretto are well-wired by construction. Bugs like polling an already closed stream or forgetting to complete a promise are prevented statically, i.e. before program execution.
How to leverage Scala with scala.js to write frontend as functional programmers would do.
Scala is improving rapidly. This session will give you the perspective of someone in the middle of these changes.
Learn about opaque types and add this new tool to your modelling toolbox!