Documentation on instance Bits Integer should be improved
This instance is pretty special:
-
Most bit operations pretend to operate on a "fake 2's complement" form, despite this note in the
Integerhaddocks:Integers are stored in a kind of sign-magnitude form, hence do not expect two's complement form when using bit operations.
-
However
popCountdoes not use the fake 2's complement form and instead returns negative results for negativeIntegers. -
rotate=shift -
The conversion from and to the fake 2's complement form incurs extra overhead for bit operations on negative numbers.
I think it would be good to document this in the haddocks of the Bits instance, and to remove or fix the note in the Integer haddocks.