Scala has a rapidly-changing ecosystem of interconnected libraries. This tends to lead to dependency hell, in which a project's transitive dependency graph contains version mismatches. Not only is this painful to manage, but current approaches leave projects vulnerable to defects that can be hard to catch in time.
In this post, we explore shading as a simple and robust approach to deconflicting transitive dependencies in Scala projects.
Refactoring provides an accessible opportunity to learn about imperative and functional design patterns, and Scala's hybrid OO/FP design caters to both.
We explore examples of Scala code written using familiar imperative design patterns, and refactor each one using a counterpart functional pattern. We learn how to replace mutable variables with the state monad, loops with folds, thrown exceptions with sum types, dependency injection with the reader monad, and much more. As we go, we build a mapping of corresponding imperative and functional patterns.
Effect systems allow the separation of the semantics of a program from the specification of a program. An effect system is made up of effect types, effectful programs, and effect handlers. An effect is an operation, behavior, pattern, or signature of which the meaning is up for interpretation by an effect handler.
We explore different ways to implement effect systems in Scala. We begin by describing an effectful program that we would like to write as a pure value. We then write different toy effect systems that can run it.