NonEmpty + Swift-Collections (OrderedSet, Deque...) #59
iDmitriyy
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi
What about adding support of swift-collections to NonEmpty?
I suppose doing it with an overlay SPM module 'NonEmpty+UpcomingCollections'.
Currently, it is not possible to express
NonEmpty<OrderedDictionary>
, because OrderedDictionary doesn't conform to Collection protocol.Another one problem with different Types of Dictionaries is impossibility to write generic Dictionary code. As a workaround, I've made NonEmptyOrderedDictionary implementation and added DictionaryUnifyingProtocol making possible common Dictionary operations in generic code with: Swift.Dictionary, OrderedDictionary, NonEmptyDictionary, NonEmptyOrderedDictionary. There are also TreeDictionary, SortedDictionary.
DictionaryUnifyingProtocol is something like _DictionaryProtocol in NonEmpty library with some differences.
With Set, OrderedSet, SortedSet, SparseSet + NonEmpty the approach is similar. For example, OrderedSet doesn't conform to SetAlgebraProtocol.
I can share code or make WIP pull request, but not sure how it is better to do.
Beta Was this translation helpful? Give feedback.
All reactions