Not long ago I've discovered Natural
data type in base
. It's supposed to be taken (as it seems to me) when you intend to use non-negative integer type. But it's not exactly clear why should I prefer Natural
to Integer
. Both types have arbitrary precision, both have quite optimized runtime representation — Integer
representation and Natural
representation. But Natural
can throw pure exceptions when you subtract natural numbers and this doesn't really add more typesafety to your code. While Integer
is more popular across all packages.
So when and why should I use Natural
?