Created
July 13, 2016 20:30
-
-
Save joescii/e120d2deba31993ebaf8bac8751b6206 to your computer and use it in GitHub Desktop.
mergeSorted for the same type of Process
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def mergeSorted[F[_], I, A: Order](sourceLeft: Process[F, I], sourceRight: Process[F, I])(f: I => A): Process[F, I] = { | |
mergeSorted(sourceLeft, f)(sourceRight, f).flatMap { | |
case Both(a, b) => Process.emit(a) ++ Process.emit(b) | |
case This(a) => Process.emit(a) | |
case That(b) => Process.emit(b) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment