add Haskell implementation