RULE traverse = traverse_?

Joachim Breitner mail at
Tue Mar 31 11:56:26 UTC 2015


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?


Joachim “nomeata” Breitner
  mail at joachim-breitner.de
  Jabber: nomeata at  • GPG-Key: 0xF0FBF51F
  Debian Developer: nomeata at
-------------- 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: <>

More information about the Libraries mailing list