There are Keyed
and FunctorWithIndexed
classes in keys
and lens` libraries respectively.
Their member functions mapWithKey
and imap
seems to be similar, except that keys
is formulated using type families, and lens
uses functional dependencies.
When one should prefer one or another? Why lens
doesn't use keys
, is it because of type-inference? Are there some interesting history of development? As a library writer, should I write variants for both Keyed f
and FunctorWithIndex i f
containers?