[Haskell-cafe] Natural Numbers: Best implementation?
Henning Thielemann
lemming at henning-thielemann.de
Sat Mar 14 18:33:32 EDT 2009
On Fri, 13 Mar 2009, Wolfgang Jeltsch wrote:
> Am Freitag, 13. März 2009 09:21 schrieb Roman Cheplyaka:
>> * Alexander Dunlap <alexander.dunlap at gmail.com> [2009-03-12 20:01:57-0700]
>>
>>> Also, a lot of functions just take
>>> Integers so it would be more of a pain to use.
>>
>> AFAIK there are very few fuctions that take Integers. Many functions
>> take instances of Integral, but it's not a problem to make your own type
>> such an instance.
>
> I’d say that it is a problem. Class instances should satisfy certain laws.
> (Although these laws are often not stated explicitely, they are assumed to
> hold by users of the class and they should hold to make the instance
> sensible.) In the case of Num, I would expect num + negate num to equal num.
"equal zero" ?
More information about the Haskell-Cafe
mailing list