
Fyi, here's a draft patch: https://github.com/hvr/packages-base/commit/03c015951a385533b9f419863c37b7df... feel free to comment on the patch (by annotating on GitHub, or discussing it here), as this is what I'll probably push to GHC HEAD after the deadline. Note: I still have to go over the existing Bits instances, to see if GHC is properly inlining/constant-folding 'clearBit (bit 0) 0' with the default-impl, or if I need to add a couple of 'zeroBits = 0' to the instances in `base`. On 2014-02-27 at 22:39:27 +0100, Edward Kmett wrote:
I like those laws insofar as they go.
It'd be nice to sit down and specify the rest of the Data.Bits laws some day. (Not volunteering!)
-Edward
On Wed, Feb 26, 2014 at 8:30 PM, wren ng thornton
wrote: I'm +1 for the following slightly extended proposal:
* add zeroBits * with default implementation: clearBit (bit 0) 0 * and requiring the following laws for all n valid for the type: * clearBit zeroBits n == zeroBits * setBit zeroBits n == bit n * testBit zeroBits n == False * popCount zeroBits == 0
-- Live well, ~wren _______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries
-- "Elegance is not optional" -- Richard O'Keefe