Skip to content
0:00 / 0:00

#scala#freemonad#monads

Composable application architecture with reasonably priced monads

Parleys

15K subscribers • 2 videos on Hallway

YouTube
  • Recommended by 1 person: 1 in engineering communities.
  • Presented by Rúnar Bjarnason, co-author of Functional Programming in Scala

Advanced. Deep dive for people who know the field.

11K views10 years ago1 recommendation

Software designProgramming languagesFunctional programmingScalaSoftware architecture

Rúnar Bjarnason explains how to design purely functional application architectures using free monads and free applicatives in Scala.

Most of us have an experience of functional programming that is isolated to small libraries or specific immutable data structures. But can we design our entire application architecture in a purely functional way? Can we do "aspect-oriented" programming with cross-cutting concerns that are compositional and checked by the type system? Yes we can, and in this talk we will look at a conceptually simple recipe for making that happen. We will see that the best things in Scala are Free. Author: Rúnar Bjarnason Rúnar Bjarnason is a senior software developer at Verizon OnCue. Rúnar is co-author of the book "Functional Programming in Scala", and an occasional speaker and blogger on Scala and functional programming.

Why it's here

1 person recommends this

What people say. Recommended as a classic talk on using free monads for composable functional architecture.

u/PM_ME_UR_OBSIDIANin r/compsci • Recommends

On “Design Patterns for Humans”

IMHO, OOP design patterns lack a punch compared to functional design patterns. Compare and contrast: - The Actor Model for concurrency; - Higher-order combinators for collections (`.map`, `.fold`, `.choose`, `.collect`, ...) which are the ancestor of LINQ; - ~~Monads~~ Burritos; - Applicatives, used for example in `optparse-applicative`; - Free structures as DSLs, particularly free monads and free applicatives; ...and probably many more which I forget right now. These are effective solutions to some very hard problems in software engineering, mostly relating to separation of concerns and testability.

u/PM_ME_UR_OBSIDIANin r/compsci • Recommends

On “What extremely simple concept did you first find extremely obscure or plain nonsensical?”

Monads scare people, so let's look into them. A monad is a generic container supporting certain operations. Some examples of monads include lists, optional values, and futures. Here are the required operations: 1. Using a function to independently transform each element in the container into a different element, while preserving the structure of the container. This is called `map`, and can be used like so: `1, 2, 3.map(numberToString) == "one", "two", "three"`. 2. Building an instance of the container from a single value. This is often called `unit`. For the monad to be law-abiding, you need `unit(x).map(f) == unit(f(x))` for any f and x. 3. Flatten nested containers, such that e.g.…