Haskell code for TAPL