TEWWDULPAUYV2VFT3LGUTXGVVDPFFTBRHXQVJAZT63D5Q2NLPS6QC
prop_sqr a = sqr a == a*a
prop_sqr a = sqr a == a * a
prop_pow :: NonZero Nimber -> Integer -> Bool
prop_pow NonZero {getNonZero = a} n = pow a n == a ^^ n
prop_pow_zero :: NonNegative Integer -> Bool
prop_pow_zero NonNegative {getNonNegative = n} = 0 `pow` n == if n == 0 then 1 else 0
-- | Raise a @'Nimber'@ to an integral power. Faster than using '^' or '^^'.
pow :: (Integral a) => Nimber -> a -> Nimber
_ `pow` 0 = 1
a `pow` n
| n < 0 = recip a `pow` negate n
| otherwise = if even n then sqr a `pow` quot n 2 else powAcc (sqr a) (quot n 2) a
where
powAcc _ 0 x = x
powAcc b m x = if even m then powAcc (sqr b) (quot m 2) x else powAcc (sqr b) (quot m 2) (b * x)