Code from learning Haskell