some algos written in haskell