Translation to Haskell of the code examples from the book "Understanding Computation" by Tom Stuart (O'Reilly 2013)