Haskell implementation of various algorithms..