lambda-llama/bitset — pull request #6 by jmazon (2013-04-23 17:12:19+00:00)
Title: BS.null has false negatives

`BS.null` doesn't always return `True` on the cases I'd like it to. It works fine on `BS.empty`, but as soon as I inserted and deleted one or more elements, it seems to stay `False`.

The cases that work:

> BS.null (BS.empty :: BS.BitSet Int)
True
> BS.null (BS.delete 42 BS.empty :: BS.BitSet Int)
True

The case that doesn't:

> BS.null (BS.delete 42 $ BS.insert 42 BS.empty :: BS.BitSet Int)
False

It seems kind of related to the `FasterInteger` implementation: if I replace the `propNullEmpty'` test in the attached patch with the following, the test passes: (replacing `BitSet` with `GBitSet Integer`)

propNullEmpty' :: [Word16] -> Bool
propNullEmpty' xs = GS.null n where
n = foldl' (flip GS.delete) bs xs :: GBitSet Integer Word16
bs = foldl' (flip GS.insert) GS.empty xs

I'm not sure I understand enough of the implementation to help more than that, but it's a start!