The scheme in Haskell tutorial, redone with more Haskell experience