The arithmoi package has an Integer
square root function called integerSquareRoot
that works for any Integral
instance.
It also has specialization rules so that you can use it on plain Ints
and have the root computed via the sqrt function on Doubles.