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 if
containers?
From the keys
package readme—
In practice this package is largely subsumed by the
lens
package, but it is maintained for now as it has much simpler dependencies.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.