PROPOSAL: Add 'Natural' type to base:Data.Word

Herbert Valerio Riedel hvr at gnu.org
Tue Nov 11 13:51:31 UTC 2014


On 2014-11-11 at 14:32:47 +0100, Richard Eisenberg wrote:
> What would the semantics of subtraction be for this? I'm assuming
> there would be a `Num` instance for `Natural`.

It wouldn't be total, and 'throw (Underflow :: ArithException)' if the
result would fall outside the non-negative domain.

This is similiar to how e.g.

 http://hackage.haskell.org/package/nats-0.2/docs/Numeric-Natural.html

handles out-of-domain subtraction results.


More information about the Libraries mailing list