Haskell code version for "Understanding Computation"