[Haskell-cafe] adding the elements of two lists
Jake McArthur
jake.mcarthur at gmail.com
Tue Mar 27 00:08:38 CEST 2012
Well, ZipList's pure is indeed repeat, but there is nothing about ZipList
restricting it to infinite lists. As long as pure is repeat, I'm pretty
sure any other value can still be finite without violating Applicative's
laws.
On Mar 26, 2012 1:02 PM, "wren ng thornton" <wren at freegeek.org> wrote:
> 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,
> ~wren
>
> ______________________________**_________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/**mailman/listinfo/haskell-cafe<http://www.haskell.org/mailman/listinfo/haskell-cafe>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120326/d2423d22/attachment.htm>
More information about the Haskell-Cafe
mailing list