id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
5872,bug in default implementation of popCount,lerkok,tibbe,"base 4.5.0.0 (http://hackage.haskell.org/packages/archive/base/4.5.0.0/doc/html/src/Data-Bits.html#popCount) gives the default implementation of popCount of the Bits class like this:

{{{
popCount          :: a -> Int
popCount = go 0
    where
        go !c 0 = c
        go c w = go (c+1) (w .&. w - 1)
}}}

Alas, .&. binds more tightly than -, thus the last expression parses as `((w .&. w) - 1)` not as `(w .&. (w-1))`, as it was intended. 

At the least, this causes `popCount :: Integer -> Int` to behave erratically:

{{{
Prelude Data.Bits> map popCount [2::Integer .. 4]
[2, 3, 4]
}}}",bug,closed,high,7.4.2,libraries/base,7.4.1,fixed,,,Unknown/Multiple,Unknown/Multiple,None/Unknown,Unknown,,,,
