Translation of SML into Haskell