
5 Dec
2007
5 Dec
'07
5:23 p.m.
On Tuesday 04 December 2007 15:47:19 David Benbennick wrote:
On Dec 4, 2007 11:51 AM, Don Stewart
wrote: Awesome. We can use this in Data.Bits, if you've got some QuickChecks for it.
Hear hear. But is there any way to just make the compiler use fastTestBit in place of testBit :: (Bits a) => a -> Int -> Bool when a = Integer? (That is, without having to introduce a new function to the public interface of Data.Bits.) Some kind of SPECIALIZE pragma, perhaps?
I've attached a program with two QuickCheck properties. Unfortunately they fail on negative Integers. I can't figure out why.
No fancy specialization is needed. Since testBit is part of the Bits class, simply 'testBit = fastTestBit' in the instance for Integer. Cheers, Spencer Janssen