Refactored examples from Doberkat's Haskell book