Day 3 -

Aug 20th

Stage 3

11:50 - 12:30

Rethinking Monad Transformers: A Submarine way for Error Handling

Error handling is a crucial aspect of software development, yet achieving a balance between simplicity, precision, and static type checking remains a challenge. Often, developers face trade-offs between code ergonomics, performance, and precise error control.

In this talk, we present an innovative approach (referred as the “submarine”) to seamlessly integrate arbitrary error types into the main Throwable channel within an effect context. This technique offers functionality akin to try/catch blocks, but with the flexibility to handle custom error types within a monadic context. By leveraging implicit capabilities for introduction and elimination, this method provides a robust error handling mechanism.

This approach is particularly effective in Scala 3, thanks to the advanced features of context functions and the inline mechanism. We will delve into the underlying problem, explore the proposed solution, and highlight the Scala 3-specific features and techniques employed in the implementation.

Thanh Le

lichess.org / Recorded Future

Thanh is a software developer based out of Gothenburg, Sweden. He is a functional programming enthusiast and has been working with Scala for over 3 years. He is a member of the Typelevel organization and a maintainer of lichess.org, a free and open-source chess server. Thanh is passionate about building high-performance, type-safe applications and has a keen interest in exploring the latest advancements in Scala 3.

Subscribe

Join our conference

Subscribe and follow @ScalaDays on BlueSky for the latest conference updates.