Bifoldable instance for Map
Andreas Abel
andreas.abel at ifi.lmu.de
Wed Jun 3 22:26:34 UTC 2020
On 2020-06-03 01:47, Joseph C. Sible wrote:
> Isn't the order of elements when you use a Traversable also arbitrary,
> since trees have depth-first and breadth-first traversals?
Do you mean the order of the effects? Yes, this order isn't specified.
The tree structure should stay intact though (including the leaves,
which are merely filled with new content).
--Andreas
> 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