title | revealOptions | theme | ||||
---|---|---|---|---|---|---|
Monix Adventures |
|
night |
Luke Stephenson https://github.com/lukestephenson/monix-adventures
- Scala
- Understanding of scala.concurrent.Future
https://github.com/lukestephenson/monix-adventures
- Star the project!
- Install sbt -
brew install sbt
- Download the internet -
sbt test
- Synchronous execution
val fahrenheit: Int = c * 9 / 5 + 32
- Asynchronous execution
val result: F[User] = loadUserFromDb()
- So we need some
F
to represent an asynchronous computation
val result: Future[User] = loadUserFromDb()
val result: Task[User] = loadUserFromDb()
val result: Task[User] = loadUserFromDb()
result.delayExecution(1.second)
- Just data
- Control of side effect execution
- Referential transparency
- Laws
val iterable: Iterable[Int] = List(1, 2, 3).toIterable
val result: Iterable[Future[String]] = readLinesFromAPI()
Note: What does this mean? As values are pulled from the Iterable, those Futures are not complete. Iterable is a data structure which doesn't model / represent asynchronous behaviour.
val result: Observable[String] = readLinesFromAPI()
Note: Asynchrony is a first class citizen
https://github.com/lukestephenson/monix-adventures
Ask for help