I've been thinking about whether there's some method that could be added to Traversable
to make it compose more cheaply in the presence of expensive functors. The inspiration was Control.Lens.Traversal.confusing
, which uses a special Applicative
to do something similar.
confusing :: Applicative f => LensLike (Curried (Yoneda f) (Yoneda f)) s t a b -> LensLike f s t a b
Unfortunately, confusing
really lives up to its name—I don't understand what it's actually doing. In particular, I have no intuition about Curried
.
Furthermore, confusing
has a CPS flavor to it, which suggests it's probably too strict for my purpose. Yoneda
can be swapped out for Coyoneda
to enhance laziness, but I have no idea what to do about the Curried
.