次の関数を scalaz-stream で実装するのに問題があります:
/**
* Same as `merge` but is biased on the left side. Both `merge` and `mergeLeftBias` are
* non-deterministic, but `merge` tries to balance results from both to the extent the
* input streams are producing results at roughly the same speed. `mergeLeftBias`
* does not make any guarantees, but it will tend to grab elements from the left
* before the right. This is can be useful if, for instance, working with two streams
* that have interdependencies, i.e. the left stream produces results indirectly
* from the right stream being pulled from. This is a fairly common scenario that
* arises when using a `Queue` to merge "back" together a stream that was separated by
* some black box API that was not build over scalaz-stream.
*/
def mergeLeftBias[I]: Wye[I,I,I] = ???
私はそれを実装しようとしているブランチを持っていますが、残念ながら単純なケースでも機能します(テストケースで実証されているように)。in scalaz-streamの実装はwye
(少なくとも私にとっては) 簡単に読めるものではありません。
https://github.com/jedesah/scalaz-stream/tree/topic/mergeLeftBiased