[Haskell-cafe] Looking for largest power of 2 <= Integer

David Benbennick dbenbenn at gmail.com
Tue Dec 4 16:47:19 EST 2007


On Dec 4, 2007 11:51 AM, Don Stewart <dons at galois.com> 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.hs
Type: text/x-haskell
Size: 712 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20071204/c1c9f1f0/foo.bin


More information about the Haskell-Cafe mailing list