#5593: Proposal: Remove Num superclass of Bits ---------------------------------+------------------------------------------ Reporter: basvandijk | Owner: Type: task | Status: new Priority: normal | Component: libraries/base Version: 7.2.1 | Keywords: Testcase: | Blockedby: Os: Unknown/Multiple | Blocking: Architecture: Unknown/Multiple | Failure: None/Unknown ---------------------------------+------------------------------------------ This ticket summarizes the [http://www.haskell.org/pipermail/libraries/2011-October/016899.html discussion] on the proposal to remove the `Num` superclass of the `Bits` type class.
The proposal is to: * Remove the `Num` superclass of the `Bits` type class. * Remove the default implementations of `bit`, `testBit` and `popCount` since they use methods of `Num`. * Export the following convenience functions from `Data.Bits`: {{{ bitDefault :: (Bits a, Num a) => Int -> a bitDefault i = 1 `shiftL` i testBitDefault :: (Bits a, Num a) => a -> Int -> Bool testBitDefault x i = (x .&. bit i) /= 0 popCountDefault :: (Bits a, Num a) => a -> Int popCountDefault = go 0 where go !c 0 = c go c w = go (c+1) (w .&. w - 1) -- clear the least significant }}} Attached are tickets for `base` and `ghc`. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5593> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs