You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 22, 2021. It is now read-only.
With default instances for all applicable collection types?
I know of at least one concrete use case: type class based decoding libraries. Let's take the example of a very simple CSV decoding library. One would write decoding type class as follows:
// Decodes a single CSV celltraitCellDecoder[A] {
defdecode(cell: String):Try[A]
}
// Decode an entire CSV rowtraitRowDecoder[A] {
defdecode(row: Seq[String]):Try[A]
}
With CanBuildFrom, it's easy to provide an instance of RowDecoder for all collection types:
I understand CanBuildFrom is going to disappear, and no mechanism is planned to emulate the above behaviour. The HasBuilder type class I'm suggesting would replace it, and is vastly simpler (and less tied to the core implementation of the collection API) than CBF.
It would ideally be part of the standard collection API, although I can't think of anything that would prevent third party libraries from providing that feature externally.