Haskell Recipes

December 28, 2016

This is an index of simple Haskell recipes for handy reference.

To run each recipe, the following script uses Nix to set up a ghc environment with specified packages, and uses codedown to extract the source code to run.

if [ $# -lt 1 ]
  echo "Usage: sh -s <recipe> [package1] [package2] [package3] ..."
  echo "Example: sh -s scotty.md scotty"
  exit 1
nix-shell \
  -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [ ${@:2} ])" \
  --run "curl -s https://earldouglas.com/notes/haskell-recipes/$1 |
         codedown haskell |