[Haskell-cafe] Num instances for 2-dimensional types

Henning Thielemann lemming at henning-thielemann.de
Tue Oct 6 19:40:52 EDT 2009


Soenke Hahn schrieb:

> If you want to use number literals, you have to implement an instance for 
> Algebra.Ring.C, if i understand correctly. Is there any special reason, why 
> fromInteger is a method of Algebra.Ring.C?

Yes, Ring is the most basic class in the hierarchy that provides a zero,
a one and addition, thus you could implement fromInteger by successively
adding or subtracting one from zero, given some basic operations on
Integer. 'fromInteger' just allows a more efficient implementation.



More information about the Haskell-Cafe mailing list