[Haskell-cafe] adding the elements of two lists

wren ng thornton wren at freegeek.org
Mon Mar 26 19:00:34 CEST 2012

On 3/26/12 8:16 AM, Jake McArthur wrote:
> This is interesting because it seems to be a counterexample to the claim
> that you can lift any Num through an Applicative (ZipList, in this case).
> It seems like maybe that only works in general for monoids instead of rings?

I'm not so sure about that. The Applicative structure of ZipLists is 
specifically defined for infinite lists (cf., pure = repeat). And in the 
case of infinite lists the (+) = zipWith(+) definition works just fine, 
since we don't have to worry about truncation. I wasn't aware that Num 
was supposed to be liftable over any Applicative, but this doesn't seem 
like a counterexample...

Live well,

More information about the Haskell-Cafe mailing list