optimizing toDigits and toDigitsRev with lessons from http://hackage.haskell.org/package/digits-0.2/docs/src/Data-Digits.html#digits