Skip to content

Instantly share code, notes, and snippets.

View cornerman's full-sized avatar
🌻

johannes karoff cornerman

🌻
View GitHub Profile
@cornerman
cornerman / IncStore.scala
Created March 27, 2019 22:14
Incremental Store
import monix.execution.{Ack, Cancelable, Scheduler}
import monix.reactive.observers.Subscriber
import monix.reactive.{Observable, Observer}
import monix.reactive.subjects.PublishSubject
import scala.concurrent.Future
trait IncStore[State, InAction, OutAction] { self =>
def initialState: State
scala> val subject = PublishSubject[Int]()
subject: monix.reactive.subjects.PublishSubject[Int] = monix.reactive.subjects.PublishSubject@5e470323
scala> val behaviorObs = subject.behavior(1)
behaviorObs: monix.reactive.observables.ConnectableObservable[Int] = monix.reactive.observables.ConnectableObservable$$anon$1@253df626
scala> subject.foreach { o => println("subject: " + o) }
res0: monix.execution.CancelableFuture[Unit] = Async(Future(<not completed>),monix.execution.Cancelable$CancelableTask@4a1ebd18)
scala> behaviorObs.foreach { o => println("behaviorObs: " + o) }

Keybase proof

I hereby claim:

  • I am cornerman on github.
  • I am cornerman (https://keybase.io/cornerman) on keybase.
  • I have a public key ASDE3pFHPft-8Mix_1WxI0R8_ydemaZ75xI-JEE3nGRr3go

To claim this, I am signing this object:

generate key pair

$ sbt "set pgpReadOnly := false" "pgp-cmd gen-key"

sonatype publishing

build.sbt:

pgpSecretRing in Global := file("secring.gpg")