Bifoldable instance for Map

Joseph C. Sible josephcsible at gmail.com
Tue Jun 2 23:47:15 UTC 2020


Isn't the order of elements when you use a Traversable also arbitrary,
since trees have depth-first and breadth-first traversals?

Joseph C. Sible

On Tue, Jun 2, 2020 at 9:39 AM Andreas Abel <andreas.abel at ifi.lmu.de> wrote:
>
> I think bitraverse makes some sense.  If you have a tree with two kinds
> of leaves, you can effectfully map over it.
>
>    bitraverse
>      :: Applicative f => (a -> f c) -> (b -> f d) -> t a b -> f (t c d)
>
> Here, the tree structure stays in place.
>
> However, bifolding is less meaningful because the ordering of elements
> in the resulting collection (monoid) is somewhat arbitrary.  This
> argument has already been raised in this thread.


More information about the Libraries mailing list