[Haskell-cafe] Natural Numbers: Best implementation?

Henning Thielemann lemming at henning-thielemann.de
Sat Mar 14 17:32:11 EDT 2009


On Fri, 13 Mar 2009, Mark Spezzano wrote:

> 1.  Don’t bother. Just use Integer.
> 
> 2.  Use the type
> 
> data Natural = Zero | Succ !Natural
> 
> 3.  Use the following definition taken from the Gentle Introduction to Haskell 98
> 
> newtype Natural = MakeNatural Integer

This option looks like non-negative package.


More information about the Haskell-Cafe mailing list