Proposal: Remove Num superclass of Bits

Ian Lynagh igloo at
Sun Oct 16 20:07:50 CEST 2011

On Sun, Oct 16, 2011 at 02:33:58AM +0200, Bas van Dijk wrote:
> On 15 October 2011 21:16, Ian Lynagh <igloo at> wrote:
> > Hmm, one can be (bit 0) though.
> But since 'one' would only be used in the default implementation of bit:
> bit i = one `shiftL` i
> we would get a circular definition.

Doh, good point.

So it's true that we could add at least zero (or zeroBits or whatever)
to Bits, but whether or not we do, all the existing instances in the
wild will need to be altered: either to define zero, or to define bit.

If we don't add zero/one, we could define things like
    numBit :: (Bits a, Num a) => Int -> a
    numBit i = 1 `shiftL` i
to make defining bit and friends slightly easier for existing instances.

I also just noticed the isSigned method. That seems a little odd,
especially if the Num constraint is removed. Should we remove that
method too?


More information about the Libraries mailing list