In haskell

Port to Haskell