<div dir="auto">No idea. Traversing in a Biapplicative can definitely be interesting. I don't know what Bifoldable or Bitraversable can do.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 2, 2020, 12:12 AM Joseph C. Sible <<a href="mailto:josephcsible@gmail.com">josephcsible@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Let me turn this around: do you believe the Bifoldable class is a<br>
useful abstraction at all? Are there any real types (i.e., that exist<br>
in `base` or some other popular library or program, rather than made<br>
up for the sake of example) that you think have a useful Bifoldable<br>
instance? In other words, is your issue actually with this instance,<br>
or is it really with the entire class?<br>
<br>
Joseph C. Sible<br>
<br>
On Mon, Jun 1, 2020 at 5:51 PM David Feuer <<a href="mailto:david.feuer@gmail.com" target="_blank" rel="noreferrer">david.feuer@gmail.com</a>> wrote:<br>
><br>
> Yes, folding generally loses structure. This just seems especially<br>
> egregious. Can you think of even a single function polymorphic over<br>
> `Bifoldable` containers that you'd find it useful to pass a `HashMap`<br>
> to?<br>
><br>
> On Mon, Jun 1, 2020 at 5:34 PM Joseph C. Sible <<a href="mailto:josephcsible@gmail.com" target="_blank" rel="noreferrer">josephcsible@gmail.com</a>> wrote:<br>
> ><br>
> > Aren't you basically just saying that you lose some of the structure<br>
> > (namely, the knowledge that the "key" and its "value" go together)?<br>
> > But doesn't every Foldable instance on a type that's more complex than<br>
> > a list also do that? For example, if you fold a rose tree, you lose<br>
> > the knowledge of which elements came from which branches.<br>
> ><br>
> > (Completely unrelated: "Loost" and the names of its data constructors<br>
> > sound like something straight from Dr. Seuss.)<br>
> ><br>
> > Joseph C. Sible<br>
> ><br>
> > On Mon, Jun 1, 2020 at 8:28 AM David Feuer <<a href="mailto:david.feuer@gmail.com" target="_blank" rel="noreferrer">david.feuer@gmail.com</a>> wrote:<br>
> > ><br>
> > > Let me be more specific. Whereas we can get intuition for Foldable from<br>
> > ><br>
> > >     toList :: t a -> [a]<br>
> > ><br>
> > > we get intuition for Bifoldable from the hypothetical<br>
> > ><br>
> > >     toEitherList :: t a b -> [Either a b]<br>
> > ><br>
> > > This seems quite reasonable for some types.<br>
> > ><br>
> > >     data Loost a b<br>
> > >       = Nool<br>
> > >       | Corns b (Loost a b)<br>
> > >       | Colns a (Loost a b)<br>
> > ><br>
> > > But for something like<br>
> > ><br>
> > >     newtype Plist a b<br>
> > >       = PNil<br>
> > >       | PCons a b (PList a b)<br>
> > ><br>
> > > it feels awfully strange. Independent parts of the structure just get lumped together.<br>
</blockquote></div>