of Haskell functions by representing side effects as generalized
algebraic data types, and implementing a side-effecting top-level
interpreter for them.
Validation: how to use it, why it
works, and where in category theory it comes from. We'll see how to use
the implementations provided by Scalaz and Cats, as well as how to roll
our own from scratch.
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.