Functional Programming

$\newcommand{\R}{\mathbb{R}}$ $\newcommand{\C}{\mathbb{C}}$ $\newcommand{\N}{\mathbb{N}}$ $\newcommand{\Z}{\mathbb{Z}}$

Haskell has a difficult learning curve at the intermediate level. I’m keeping track of resources and short code snippets I find useful in that regard.


Extremely useful overview of important Haskell library and features

Parser combinators

A tutorial for a good parser combinator library

Example of simple parser combinators written from the ground up

Recursion via fixpoints

Excellent introduction to difficult topic and another blog post which builds on that.

Recursion schemes and free monads

Necessary to first understand fix.

Great tutorial building up to Free from scratch.

Another good tutorial on free monads

Category theory

Lovely summary of category theory origins of monads and adjunctions with the beautiful diagrammatic notation that this kind of stuff allows for.

Category theory for programmers. Learn why a monad is a monoid in the categories of endofunctors, and why polymorphic functions are natural transformations.

Functional Reactive Programming

Took me a while to find out what this actually meant, but thankfully this 2015 talk by Conal Elliott (or this version) precisely answers that question.

Probabilistic programming

Example of how to build simple probabilistic programming DSL in Haskell

Use of fancier probabilistic programming language (code snippet)

For fun

The most brain-bending quine:

powerset = filterM (const [True,False])