Proposal: add new Data.Bits.Bits(bitZero) method (was: Proposal: Explicitly require "Data.Bits.bit (-1) == 0" property)

Eric Mertens emertens at gmail.com
Sun Feb 16 16:51:49 UTC 2014


The last time this topic came up (back when Num was split off) the
discussion was derailed by the idea of a Bool class and then forgotten.
I've hoped for an explicit zero element since then.

+1 zeroBits
On Feb 16, 2014 8:45 AM, "Edward Kmett" <ekmett at gmail.com> wrote:

> `bitZero` sounds like it should equal `bit 0`, which it doesn't.
>
> zeroBits ?
>
> -Edward
>
>
> On Sun, Feb 16, 2014 at 11:42 AM, Herbert Valerio Riedel <hvr at gnu.org>wrote:
>
>> Hi,
>>
>> On 2014-02-16 at 15:10:42 +0100, ARJANEN Loïc Jean David wrote:
>> > I'll have to come down against that proposal because, at least on amd64
>> for 64
>> > bits-sized types (Int, Int64, Word & Word64), it doesn't works.
>>
>> You're right, I don't know how I could have missed that :-/
>>
>> Since the presumed pre-condition for the proposal (that 'bit (-1) == 0'
>> would already hold) I hereby amend the proposal to
>>
>> > Introduce a new class method
>> >
>> >   class Bits a where
>> >       ...
>> >       -- | Value with all bits cleared
>> >       bitZero :: a
>> >       ...
>> >
>> > modulo naming of 'bitZero'
>>
>> (I'm hesitant to consume "zero" from the namespace as was suggested by
>> Henning)
>> _______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://www.haskell.org/mailman/listinfo/libraries
>>
>
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20140216/4be46c8a/attachment-0001.html>


More information about the Libraries mailing list