I want to compose a curried function
f :: i -> a -> b
With an indexed traversal
l :: IndexedTraversal' i s a
apply it to an s
and get back a [b]
.
I came up with
s ^.. l . withIndex . to (uncurry f)
But I would like a combinator itoListByOf
that would allow me to do this
s & itoListByOf l f
Like
itoListByOf :: IndexedGetting i (Endo [b]) s a -> (i-> a -> b) -> s -> [b]
itoListByOf l f = ifoldrOf l (\i a -> (f i a :)) []
But I want to make sure I'm not missing this combinator hiding in the library with a more general type.