Useful code for building compilers in Haskell.