Haskell data structures and algorithms