I hereby claim:
- I am alexandru on github.
- I am alexelcu (https://keybase.io/alexelcu) on keybase.
- I have a public key ASBWqVm1zLnfV5US_esPsp37bSZ-figcSqX0HHGB1h0YWgo
To claim this, I am signing this object:
| sealed trait State { def count: Int } | |
| case class Odd(count: Int) extends State | |
| case class Even(count: Int) extends State | |
| case class Emit(count: Int) extends State | |
| val scanned = | |
| observable.scan(Empty : State) { (state, elem) => | |
| val newState = state match { | |
| case Odd(count) => |
| 3: new #18 // class scala/Some | |
| 6: dup | |
| 7: ldc #20 // String foo | |
| 9: invokespecial #24 // Method scala/Some."<init>":(Ljava/lang/Object;)V | |
| 12: invokevirtual #28 // Method scala/Some.get:()Ljava/lang/Object; | |
| 15: invokevirtual #31 // Method scala/Predef$.println:(Ljava/lang/Object;)V |
I hereby claim:
To claim this, I am signing this object:
| import monix.eval.Task | |
| import monix.execution.Scheduler | |
| import scala.util.control.NonFatal | |
| /** Evaluates the given non-strict value on a given | |
| * `Scheduler`, meant for expensive I/O. | |
| * | |
| * NOTE: the returned task is not cancelable. In this | |
| * instance you wouldn't gain anything by it. | |
| */ |
| import monix.reactive._ | |
| import monix.eval.{Callback, Task} | |
| import monix.execution.Ack.{Continue, Stop} | |
| import scala.util.control.NonFatal | |
| def fromAsyncStateAction[S,A](seed: => S)(f: S => Task[(A,S)]): Observable[A] = | |
| Observable.unsafeCreate[A] { (subscriber) => | |
| import subscriber.scheduler | |
| def loop(state: S): Task[Unit] = |
| /* | |
| * Copyright (c) 2014-2016 by its authors. Some rights reserved. | |
| * See the project homepage at: https://monix.io | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * |
| /** | |
| * Copyright (C) 2009-2016 Lightbend Inc. <http://www.lightbend.com> | |
| * See: https://github.com/akka/akka/blob/master/LICENSE | |
| */ | |
| import language.implicitConversions | |
| import scala.concurrent.duration.Duration | |
| import scala.collection.mutable | |
| import akka.routing.{ Deafen, Listen, Listeners } | |
| import scala.concurrent.duration.FiniteDuration |
| import java.io.{File, FileInputStream} | |
| import java.util | |
| import monix.execution.Cancelable | |
| import monix.reactive.Observable | |
| import scala.util.control.NonFatal | |
| def fromInputStream(in: java.io.InputStream, chunkSize: Int = 256): Observable[Array[Byte]] = { | |
| val iterator = new Iterator[Array[Byte]] { | |
| private[this] val buffer = new Array[Byte](chunkSize) | |
| private[this] var lastCount = 0 |
| /** Describes the internal state of `withStateFrom`. */ | |
| sealed trait WithLatestFrom[+A,+B] | |
| extends Product with Serializable | |
| object WithLatestFrom { | |
| /** Combines each element emitted by `source` with the latest | |
| * element emitted by `b`. | |
| * | |
| * See: | |
| * |
| import monix.execution._ | |
| import monix.execution.RunLoop.FrameId | |
| def fibbonacciWithMacros(iterations: Int, callback: BigInt => Unit) | |
| (implicit s: Scheduler): Unit = { | |
| def loop(idx: Int, a: BigInt, b: BigInt, frameId: FrameId): Unit = | |
| if (idx >= iterations) callback(b) else | |
| RunLoop.step(frameId) { frameId => loop(idx+1, b, a+b, frameId) } | |