Last active
August 29, 2015 14:09
-
-
Save dcsobral/61d1e6cfe1324011f616 to your computer and use it in GitHub Desktop.
This file contains 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
import scalaz._ | |
import Scalaz.{merge => _, _} | |
import scalaz.concurrent._ | |
import scalaz.stream._ | |
import scala.concurrent.duration._ | |
implicit val defaultScheduler = scalaz.stream.DefaultScheduler | |
val flag = async.signal[Boolean] | |
val reset = Process.eval(flag set true).drain | |
val sleep = Process sleep 50.millis | |
val check = Process eval flag.get | |
val completeEmitAll = Process.eval(flag set false).drain | |
val emitAll: Process[Task, Process[Task, Boolean]] = Process(reset, sleep, check) onComplete completeEmitAll | |
val test = for { | |
join <- emitAll.join.runLast | |
mergeN <- merge.mergeN(emitAll).runLast | |
} yield (join exists identity, mergeN exists identity) | |
val (join, mergeN) = test.run | |
assert(join) | |
assert(mergeN) // fails! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
And here's a test case which has reproducible assertions: