Beginning of a Haskell implementation