[Mid-discussion Summary] Proposal: add new Data.Bits.Bits(bitZero) method

Casey McCann cam at uptoisomorphism.net
Mon Feb 24 19:56:48 UTC 2014

On Mon, Feb 24, 2014 at 1:09 PM, Henning Thielemann
<schlepptop at henning-thielemann.de> wrote:
> Am 24.02.2014 18:57, schrieb Brandon Allbery:
>> There is something vaguely smelly about specifically omitting the context
>>  > it is an annoyingly common name to take for
>>> such an often unqualified import.
>> in the original message. Yes, we're quite aware you do not consider it
>> legitimate. Distorting someone else's meaning to press your point is
>> also not legitimate.
> The phrase "reserve 'zero'" suggests that once we choose Bits.zero, the
> identifier 'zero' is reserved once and for all and cannot be used for
> something different anymore. That is, this phrasing removes the option of
> qualified imports from the scope and thus generates the wrong context.
> Can someone please, please tell me why we must avoid qualified imports at
> all costs? Why is this option repeatedly ignored when just saying zeroBits
> (+1) or zero (-1)?

Because it is a thoroughly irrelevant option, empirically speaking, on
account of approximately nobody actually using Data.Bits that way.

Based on a quick Google search of hackage, here are the use cases
wherein Data.Bits is imported qualified:

- Intentionally defining functions with clashing names which are then
exported with the intent of being imported unqualified elsewhere
- Machine-generated code too lazy to worry about namespace issues
- Commented-out import lines

Your own code, by the way, falling into the third category.

If your primary contention here is that core library APIs should be
re-designed based not on how they are actually used in practice, but
rather on pie-in-the-sky notions regarding how they ought to be used
in some uniquely ideal world, perhaps you should raise that point in
its own thread rather than endlessly hijacking discussions about
modules you may or may not even use. A debate over painting new doors
for a bikeshed is not the time or place to propose tearing down the
entire shed and building a gazebo in its place.

As for the real question, I'd prefer something along the lines of
"clearedBits". Only the haddock comments on the shift functions use
1/0 to talk about individual bits, the function names and the other
haddocks consistently use set/clear. It's not a big deal though.

I'm also wondering if anyone has examples of the name "zero" in code
that's actually used and doesn't expect to stomp all over the
namespace anyway by redefining arithmetic. "zero" sounds suspiciously
like one of those names that's so common nobody actually uses it
because they don't want to clash with all the other places it's being
conspicuously not used. (see: mzero, zeroArrow...)

I'm not at all sure Data.Bits is the flag we'd want to plant in it
regardless, but it would be nice to know if "zero" is actually in
common use.

- C.

More information about the Libraries mailing list