[core libraries] Re: PROPOSAL: Add 'Natural' type to base:Data.Word

Edward Kmett ekmett at gmail.com
Tue Nov 11 15:10:16 UTC 2014


It makes sense to just re-export it from Data.Word, narrow readings of the
wording aside.

Words can, after all, be changed and don't necessarily represent some grand
insight from the past.

After all this is the module where the note about how we could add Natural
in the first place lives.



On Tue, Nov 11, 2014 at 10:01 AM, Herbert Valerio Riedel <hvr at gnu.org>
wrote:

> On 2014-11-11 at 15:30:49 +0100, Henning Thielemann wrote:
> >> ,----
> >> | 23.1 Unsigned integral types
> >> |
> >> | This module provides unsigned integer types of unspecified width
> (Word)
> >> | and fixed widths (Word8, Word16, Word32 and Word64). All arithmetic is
> >> | performed modulo 2^n, where n is the number of bits in the type.
> >> |
> >> | ...
> >> `----
> >
> > "Number of bits in the type" suggests, that the number of bits depends
> > only on the type, which is not true for Natural (and Integer), right?
>
> Yeah, if that `n` is meant to mean a finite natural value, then you've
> got a point here.
>
> Otoh, one could maybe consider 'Natural' following modulo arithmetic 2^n
> with an infinite number `n` of bits, and hence can never arithmetically
> overflow. If an operation would, however, cause an underflow it simply
> 'throw (Underflows :: ArithException)'.
>
> However, one could extend the Data.Word documentation to note
> that 'Natural' represents an asymptotic limit/exception here with
> respect to modulo 2^n arithmetic... :-)
>
> Cheers,
>   hvr
>
> --
> You received this message because you are subscribed to the Google Groups
> "haskell-core-libraries" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to haskell-core-libraries+unsubscribe at googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20141111/095a6324/attachment-0001.html>


More information about the Libraries mailing list