RULE traverse = traverse_?

Joachim Breitner mail at joachim-breitner.de
Tue Mar 31 11:56:26 UTC 2015


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20150331/7cc175e3/attachment.sig>


More information about the Libraries mailing list