Skip to content

Monads by Matt Peddie & Stacking your Monads - Ben Kolera

Photo of Ben Kolera
Hosted By
Ben K. and 2 others
Monads by Matt Peddie & Stacking your Monads - Ben Kolera

Details

Monads - Matt Peddie

Over the last couple of yorgey lectures, we have seen how the Applicative class allows us to idiomatically handle computations which take place in some sort of “special context”—for example, taking into account possible failure with Maybe, multiple possible outputs with [], consulting some sort of environment using ((->) e), or construct parsers using a “combinator” approach, as in the homework.

However, so far we have only seen computations with a fixed structure, such as applying a data constructor to a fixed set of arguments. What if we don’t know the structure of the computation in advance – that is, we want to be able to decide what to do based on some intermediate results?

Stacking Your Monads - Ben Kolera

A common hurdle in the journey to serious FP use is being able to make the jump from functional programming in the small to being able to write non-trivial applications that are easily configurable and clearly delineate side effects and error conditions.

In this talk, we will introduce ExceptT and run through what you need to know to consume a monad transformer as a user. We'll then combine this with ReaderT for configuration and then look into the lovely MonadReader, MonadError and MonadIO typeclasses and how they make things even nicer.

At the very least, with this knowledge you should start having a much easier time consuming effectful haskell APIs (e.g. Persistent, Snap) as they are heavily based around these ideas. At best, you'll be equipped to start writing non-trivial FP programs for fun and profit.

The talk will be accompanied with a full-working program that you'll be able to tinker with and learn from outside of the talk; written in much the same style as the production haskell code written at iseek.

Photo of Brisbane Functional Programming Group (BFPG) group
Brisbane Functional Programming Group (BFPG)
See more events
NICTA Queensland
70/72 Bowen St Spring Hill, Queensland 4000 · Brisbane