[Haskell-cafe] adding the elements of two lists
Chris Smith
cdsmith at gmail.com
Mon Mar 26 18:43:06 CEST 2012
On Mon, Mar 26, 2012 at 10:18 AM, Jerzy Karczmarczuk
<jerzy.karczmarczuk at unicaen.fr> wrote:
> So, * the addition* is not invertible, why did you introduce rings ...
My intent was to point out that the Num instance that someone
suggested for Num a => Num [a] was a bad idea. I talked about rings
because they are the uncontroversial part of the laws associated with
Num: I think everyone would agree that the minimum you should expect
of an instance of Num is that its elements form a ring.
In any case, the original question has been thoroughly answered... the
right answer is that zipWith is far simpler than the code in the
question, and that defining a Num instance is possible, but a bad idea
because there's not a canonical way to define a ring on lists. The
rest of this seems to have devolved into quite a lot of bickering and
one-ups-manship, so I'll back out now.
--
Chris Smith
More information about the Haskell-Cafe
mailing list