Add popCount to Data.Bits
Now when we have a fast popCnt# primop it would be nice to expose it to the world through an official API. I propose we add this method to the Bits class in Data.Bits:
-- | Return the number of set bits in the argument, know as the
-- population count or the Hamming weight.
popCount :: a -> Int
The proposal was discussed and agreed upon in this thread: http://thread.gmane.org/gmane.comp.lang.haskell.libraries/16073
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.2.1 |
| Type | FeatureRequest |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | libraries/base |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |