<div dir="ltr"><div><div><div><div>Instances for MonadZip not always defined as "liftM2 (,)".<br><br></div>Compare:<br><br>> liftM2 (,) (Alt [1..2]) (Alt ("foo"))<br>Alt {getAlt = [(1,'f'),(1,'o'),(1,'o'),(2,'f'),(2,'o'),(2,'o')]}<br><br>> mzip (Alt [1..2]) (Alt ("foo"))<br>Alt {getAlt = [(1,'f'),(2,'o')]}<br></div></div></div><br></div><div class="gmail_extra"><br><div class="gmail_quote">2017-04-20 23:07 GMT+03:00 Mateusz Kowalczyk <span dir="ltr"><<a href="mailto:fuuzetsu@fuuzetsu.co.uk" target="_blank">fuuzetsu@fuuzetsu.co.uk</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 04/20/2017 08:19 PM, MarLinn wrote:<br>
><br>
>> The question is why does<br>
>><br>
>> ```<br>
>> mzip /= liftM2 (,)<br>
>><br>
>> ```<br>
><br>
> I don't have any evidence, but my gut feeling is that indeed mzip ==<br>
> liftM2 (,) == liftA2 (,), but that MonadZip just predates many advances,<br>
> and that it's not used often enough to warrant changing. Especially<br>
> because changing stuff in base comes with huge costs and long debates.<br>
<br>
</span>Normally I would agree but in case of adding instances, there are no<br>
real costs or long debates. Indeed to add a lawful instance you could<br>
just send a diff to GHC and see it in next version. In my experience<br>
there are only arguments where there are multiple possible "reasonable"<br>
instances &c. Hence my question in this case.<br>
<br>
Even if it was legacy, IO was around in 2011 and there seems to be no<br>
reason why it wouldn't have been one of the default instances.<br>
<span class=""><br>
> Today I would expect something similar to look somewhat more like this:<br>
><br>
> ```<br>
> class Applicative f => Unzippative f where<br>
>      unzipF :: f (a,b) => (f a, f b)<br>
> ```<br>
><br>
> I personally can't remember a single time that function would have come<br>
> in handy, so I'm happy with Applicative. And I'm projecting that<br>
> experience onto others and drawing the conclusion of "Meh.".<br>
><br>
<br>
</span>I think we have a bunch across projects.<br>
<span class=""><br>
> But if you find out more after<br>
>> investigating for next 30 minutes<br>
><br>
> I'd be interested to hear. ;)<br>
<br>
</span>Me too! Maybe on weekend if there are no good replies.<br>
<span class="im HOEnZb"><br>
> Cheers,<br>
> MarLinn<br>
> ______________________________<wbr>_________________<br>
> Haskell-Cafe mailing list<br>
> To (un)subscribe, modify options or view archives go to:<br>
> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/haskell-<wbr>cafe</a><br>
> Only members subscribed via the mailman list are allowed to post.<br>
><br>
<br>
<br>
</span><span class="HOEnZb"><font color="#888888">--<br>
Mateusz K.<br>
</font></span><div class="HOEnZb"><div class="h5">______________________________<wbr>_________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/haskell-<wbr>cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</div></div></blockquote></div><br></div>