Programming Languages

Workshop at HaL workshop

Philipp Schuster
Alumni
Philipp Schuster
presents Ten example uses of monads at Haskell in Leipzig workshop series.

Abstract

This is a workshop for Haskell beginners that motivates monads. In this “monad tutorial” we are not going to learn what monads are, how they are implemented or how they work internally. After a quick introduction to the syntax we are going to look at ten practical use cases. We will look at a selection of concurrency, resource management, build dependencies, stream processing, distributed programming, probabilities, server programming, database queries, mutable references, search, test specification and parsing.

I provide a repository on github with a small example for each monad discussed. If you want to follow along you should clone that repository and start from there. To compile the examples you can use either cabal or stack. We will go through each example to motivate the used monad. Then we will extend each example with a small feature.

We will keep selecting examples from the following list until the time is up.

  • STM: Software transactional memory for concurrency.
  • Resource: Automatic resource management.
  • Action (shake): GNU make embedded in Haskell.
  • Pipe: Stream processing.
  • Process: Distributed programming.
  • Probability: Probability distributions.
  • Scotty: Web server framework.
  • Relation: SQL embedded in Haskell.
  • ST: Mutable references.
  • Logic: Backtracking search.
  • Spec: Test specification.
  • Parser: Parse binary and textual data.
  • Canvas: Draw on HTML 5 Canvas.

Those examples hopefully demonstrate the broad applicability of the monad concept.

Further Information