folded :: Foldable f => Fold (f a) a (ref) doesn't seem to have a definition in Lens.Family2; what is the appropriate way to use folded with Lens.Family2?
folded :: Foldable f => Fold (f a) a (ref) doesn't seem to have a definition in Lens.Family2; what is the appropriate way to use folded with Lens.Family2?
traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f () is lens-like.
folded :: Foldable t => Fold (t a) () a b
folded = traverse_
In fact, we know that the f is Phantom (from Fold's definition) — traverse_'s return value doesn't actually contain any ()s — so in theory you should be able to generalise Folded's type using coerce:
folded :: Foldable t => Fold (t a) u a b
folded f = coerce . traverse_ f
(This should work for any Fold s t a b; the t and b parameters are always phantom. That's why lens's Fold only has two parameters.) Alas, it seems coerce is not exported by Lens.Family2, so you can't actually write this code. I would submit a feature request but I can't figure out where to send it.