
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
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@joachim-breitner.de • http://www.joachim-breitner.de/ Jabber: nomeata@joachim-breitner.de • GPG-Key: 0xF0FBF51F Debian Developer: nomeata@debian.org
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries