[Haskell-cafe] positive Int
David Menendez
zednenem at psualum.com
Thu Aug 2 20:56:29 EDT 2007
On 8/2/07, David Roundy <droundy at darcs.net> wrote:
> This would be a very nice type to have (natural numbers), but is a tricky
> type to work with. Subtraction, for instance, wouldn't be possible as a
> complete function...
There is a subtraction-like operation for naturals, where a - b = 0 if
a <= b. This is analogous to the way that "drop n xs" returns [] if n
>= length xs, but using it in a Num instance would probably violate
too many assumptions.
The desire to support naturals was the motivation for including
semirings in my Num refactoring thought-experiment.
<http://article.gmane.org/gmane.comp.lang.haskell.cafe/15141/>
More information about the Haskell-Cafe
mailing list