Open recursion-ninja opened 5 years ago
Sorry it took me so long to review this! Indeed, if Foldable1
offers toNonEmpty
, then it makes sense for FoldableWithKey1
to offer something similar.
One minor question about naming: how would you feel about naming the method toKeyedNonEmpty
instead? That way, toKeyedList
would be to toList
as toKeyedNonEmpty
would be to toNonEmpty
in terms of naming conventions.
The
FoldableWithKey1
type-class needs a way to safely expose aNonEmpty
of keyed associations whose implementation can also be overridden for efficiency.I added the
toKeyedNonEmptyList
method to the type-class definition with a default implementation.This new method is analogous to the
toKeyedList
method of theFoldableWithKey
type-class.