TikhonJelvis/modular-arithmetic — pull request #1 by klao (2013-07-28 20:56:21+00:00)
Title: Fix toMod' to not truncate the result

Change toMod' to first take the modulus and only then convert from one Integral to another.

Otherwise, if you have a large Integer (say 2^100 :: Integer) and you convert it with the current toMod' into Int/10 then you get a wrong result. The number first gets truncated to fit into an Int, and then we take its remained mod 10.