cats
cats copied to clipboard
RFC: Clean up NonEmptyMap interface
NonEmptyMap is a bit annoying to use due to some inconsistencies:
- Although it has a
.keysmethod likeMapdoes, it doesn't have a corresponding.valuesmethod. There's something similar possible with.toNonEmptyList(fromNonEmptyTraverse), but that's not very discoverable. I suggest we adddef values: NonEmptyList[A] = this.toNonEmptyList. - It has a
.toNelmethod that produces a NEL of pairs. This is inconsistent with.toListand (which is especially silly) with.toNonEmptyList. I suggest we renametoNeltopairsor something like that.
Strong :+1: from me. The NonEmptyX APIs are just generally an inconsistent mess and will need a major overhaul for 3.0. I've been avoiding this for the most part until then, but if someone wants to try to do some binary-compatible clean-up sooner I'm all for it.
If we are going to overhaul NEx in 3.0, I would like to bring back my original opinion back when they were organically introduced to cats: cats shouldn't be burdened with a collection library. I propose we consider moving them out in 3.0, keeping one for cats core's own use.
@kailuowang Agreed. There will be some work involved in extricating Reducible and some of the other cata.data stuff, but I think it'd be worth it.