Rewrite this in Haskell
Rewrite this in Haskell