RULE traverse = traverse_?

Edward Kmett ekmett at gmail.com
Tue Mar 31 15:28:23 UTC 2015


On an instance by instance basis I have zero objection and it can
definitely work fine.

-Edward

On Tue, Mar 31, 2015 at 7:56 AM, Joachim Breitner <mail at joachim-breitner.de>
wrote:

> Hi,
>
>
> Am Dienstag, den 31.03.2015, 07:04 -0400 schrieb Edward Kmett:
>
> > Your proposed optimization breaks at least the (2a) approach above.
> >
> > The key is don't get to know that `foldMap f` and `getConst . traverse
> > (Const . f)` for a given container build the exact same tree. One
> > might associate differently than the other, and in fact if you
> > supplied a definition of the Foldable in terms of foldr and the
> > Traversable in terms of traverse, this is precisely what happens, so
> > it isn't even an academic exercise. =/
>
> This argues against a generic "traverse = traverse_" rule. But how about
> per-instances rules, for instances where we know that they build the
> applicative result in the same way?
>
> Greetings,
> Joachim
>
> --
> Joachim “nomeata” Breitner
>   mail at joachim-breitner.dehttp://www.joachim-breitner.de/
>   Jabber: nomeata at joachim-breitner.de  • GPG-Key: 0xF0FBF51F
>   Debian Developer: nomeata at debian.org
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20150331/1edfdb71/attachment-0001.html>


More information about the Libraries mailing list