
On Fri, 12 Aug 2011, Paterson, Ross wrote:
wren ng thornton [wren@freegeek.org] writes:
On 8/10/11 9:53 AM, Paterson, Ross wrote:
Yet another restructuring of the Prelude numeric classes on algebraic lines, proposed for a revision of the Haskell Prelude:
Very nice in its simplicity, but it suffers from the same problem as all the other attempts I've seen. Namely it ignores the importance of semirings and runs headlong towards fields and beyond. The {(-), abs, signum, negate} methods really must be broken out from (+).
abs and signum are already split off, but it could be further split, with Monoid and Semiring subclasses of AbelianGroup and Ring, and that would fit nicely with a Natural type. I wasn't sure it was worth it (having + operate on lists might be confusing for beginners).
Having a (+) is possible for both Additive Group or more fine-grained classes, isn't it? There is still the question, whether (+) lists shortens like zipWith (+) or expands to the longer list. Or do you even mean to define (+) as being (++) on lists? (Which would be also non-commutative, that is, non-Abelian.)