Cool stuff, and seems like potentially a good example of this property-based testing.
tee is tricky to work with and I don’t think I’ve ever dared use wye. At a previous job I wrote a generic “alignByKey”-type method for merging two ordered streams according to an orderable key, returning a stream of \&/s, but I don’t think that ever made it back to open-source; still, it sounds like the function general enough to worth contributing back to scalaz-stream (or I’ll do it)? (I’m never quite sure how many people in the world are actually using these things, particularly with a library as underdocumented as scalaz-stream). Ideally it would be nice to have a distinct notion of a sorted stream at the type level, and then we could merge them with a lot more confidence.
I’m not sure I’d be happy with accepting that get is associative without knowing why. Maybe that’s just something one has to adjust to.
The Semigroup implementation for append is the trivial one. Maybe it would be better to separate the read and write interfaces, then the read side becomes a Monoid and the write side can just be used directly to write to the primary if that’s the behaviour you want?
A coworker on a different team wrote a very similar function to yours. He tried submitting it back to scalaz-stream. The problem is that scalaz-stream is now fs2 which has no dependencies. The implementation used scalaz' useful Ord type-class so the maintainers said it can’t get merged:
Really sucks to have a coworker do a good job but get blocked trying to push it upstream.
The Semigroup implementation for append is the trivial one. Maybe it would be better to separate the read and write interfaces, then the read side becomes a Monoid and the write side can just be used directly to write to the primary if that’s the behaviour you want?
It feels like the community is going for a combinatorial explosion where every combination of libraries has to be a separate library. Admittedly makes a bit of sense while we have ScalaZ and Cats competing. One could make an ordered stream functions library that depended on both fs2 and some provider of ordering? It’s pretty easy to release a library to maven central once you’ve done it a few times and got used to the gpg signing and the like.
Cool stuff, and seems like potentially a good example of this property-based testing.
teeis tricky to work with and I don’t think I’ve ever dared usewye. At a previous job I wrote a generic “alignByKey”-type method for merging two ordered streams according to an orderable key, returning a stream of\&/s, but I don’t think that ever made it back to open-source; still, it sounds like the function general enough to worth contributing back to scalaz-stream (or I’ll do it)? (I’m never quite sure how many people in the world are actually using these things, particularly with a library as underdocumented as scalaz-stream). Ideally it would be nice to have a distinct notion of a sorted stream at the type level, and then we could merge them with a lot more confidence.I’m not sure I’d be happy with accepting that
getis associative without knowing why. Maybe that’s just something one has to adjust to.The Semigroup implementation for append is the trivial one. Maybe it would be better to separate the read and write interfaces, then the read side becomes a Monoid and the write side can just be used directly to write to the primary if that’s the behaviour you want?
A coworker on a different team wrote a very similar function to yours. He tried submitting it back to scalaz-stream. The problem is that scalaz-stream is now fs2 which has no dependencies. The implementation used scalaz' useful Ord type-class so the maintainers said it can’t get merged:
https://github.com/functional-streams-for-scala/fs2/pull/543
Really sucks to have a coworker do a good job but get blocked trying to push it upstream.
I think that would be a great approach.
It feels like the community is going for a combinatorial explosion where every combination of libraries has to be a separate library. Admittedly makes a bit of sense while we have ScalaZ and Cats competing. One could make an ordered stream functions library that depended on both fs2 and some provider of ordering? It’s pretty easy to release a library to maven central once you’ve done it a few times and got used to the gpg signing and the like.