Coded CalcStats in Haskell