[Haskell-cafe] positive Int

Lauri Alanko la at iki.fi
Thu Aug 2 17:25:19 EDT 2007

On Thu, Aug 02, 2007 at 02:08:33PM -0700, David Roundy 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...

Of course it would. It would just have the type Nat -> Nat -> Integer.

This of course means that Nat wouldn't be an instance of Num. Tough
luck, and one more reason for more fine-grained algebraic class
hierarchy: Nat would be a semiring (as would booleans and finite sets
and regular expressions and whatnot).


More information about the Haskell-Cafe mailing list