Basic Algorithms implemented in Haskell