Last active
September 30, 2015 01:49
-
-
Save pchiusano/cf6e6f1b1271c113d1a1 to your computer and use it in GitHub Desktop.
Some simple primitives for inverting control in FS2
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
trait Ack[+W] | |
object Ack { | |
case class Accept(unprocessedSize: Int) extends Ack[Nothing] | |
case class Halt(unprocessed: Seq[W]) extends Ack[W] | |
case class Fail(err: Throwable, unprocessed: Seq[W]) extends Ack[W] | |
} | |
trait Input[+W] | |
object Input { | |
case class Send[W](chunk: Chunk[W]) extends Input[W] | |
case object Done extends Input[Nothing] | |
case class Fail(err: Throwable) extends Input[Nothing] | |
} | |
def asyncs[W](register: (Input[W] => Ack[W]) => Unit): Task[Stream[Task,W]] = ??? | |
def signal[W](w: W)(register: (Input[W] => Ack[W]) => Unit): Task[Stream[Task,W]] = ??? |
To convert result of signal
to a continuous version:
def hold[F[_]:Async,A](p: Stream[F,A]): Stream[F,A]
Not sure about the names asyncs
and signal
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Might want
asyncs
andsignal
to take aStrategy
.