Proposal: Export Data.Word.Word from Prelude

Henning Thielemann schlepptop at henning-thielemann.de
Sat Aug 9 19:25:50 UTC 2014


Am 09.08.2014 um 21:15 schrieb Anthony Cowley:

> While I am +1 on this idea, I think it's worth acknowledging an unfortunate aspect of the name. The name "Word" has good reason, but, without any context, reasonable people will guess it has something to do with Strings. Add to this that other names like "uint" or its more verbose form are perhaps more common among programming languages. When given a numeric suffix, such as Word8 or Word32, some of the ambiguity is shed, but here we would instead see the unadorned name in many places.

This is my concern, too. I think Word refers to the "machine word", i.e. 
data of a size that the processor can optimally cope with. There is no 
reason why Word should represent a non-negative number, its just a bit 
pattern. Furthermore Word (like Int) has no protection against overflow, 
e.g. (-1 :: Word) is accepted without any warnings.


> I don't have any concrete suggestions for improving this that aren't somewhat groan worthy (eg type UInt = Word), but perhaps someone else might at least offer some comforting words. (Sorry)

Modula calls non-negative integers CARDINAL. I like the name. In Haskell 
there could be a Cardinal type for arbitrary size non-negative integers 
and Card for machine size integers, although the latter one could be 
misunderstood as cards used in card games.



More information about the Libraries mailing list