Skip to content

Commit

Permalink
finalish cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmad Ragab committed Nov 9, 2018
1 parent 5a9215d commit 924c6e7
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 47 deletions.
4 changes: 1 addition & 3 deletions PITCHME.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

---?include=assets/md/04_zio/PITCHME.md

---?include=assets/md/05_inter-op/PITCHME.md

---?include=assets/md/06_conclusion/PITCHME.md
---?include=assets/md/05_conclusion/PITCHME.md


6 changes: 3 additions & 3 deletions assets/css/PITCHME.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
}

.reveal pre code {
font-size: 0.8em;
font-size: 0.75em;
}

.reveal li {
font-size: 60%
font-size: 70%
}

.title-box {
Expand All @@ -24,5 +24,5 @@
.footnote {
color: gray !important;
font-style: italic !important;
font-size: .3em !important;
font-size: .4em !important;
}
2 changes: 1 addition & 1 deletion assets/md/02_future/PITCHME.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ object Helper {
@snapend

- Handles certain exceptions differently from others |
- TimeoutException i.e. ControlThrowable |
- Errors |
- scala.runtime.NonLocalReturnControl[_] |
- InterruptedException |

Expand Down
2 changes: 1 addition & 1 deletion assets/md/02a_return/PITCHME.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@snap[north]
@color[#eb4500](Return: Off topic rant)
@color[#eb4500](return: Off topic rant)
@snapend

[Don't Use Return in Scala](https://tpolecat.github.io/2014/05/09/return.html)
Expand Down
34 changes: 7 additions & 27 deletions assets/md/03_io/PITCHME.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,14 @@
+++

@snap[north]
@color[#eb4500](Substitutional Impurity)
@color[#eb4500](What we need)
@snapend

#### Why do we say that println is impure?

```scala
println("Hello World")
// Any => Unit or ()
```

- It breaks substitution because I cannot replace () with println without changing the effect my program has

+++

@snap[north]
@color[#eb4500](Purity is not enough)
@snapend

```scala
object Pure {
def println(msg: String) = () => Predef.println(msg)
}

// Pure.println("IO is cool") is equivalent to () => Predef.println(msg)
```

- Thunks EVERYWHERE? |
- At some point we've got to dispatch these actions |
- Fine grained control over when and how to execute |
- Blocking |
- Concurrently |
- In Parallel |

- Also, we'd like some abstractions for different evaluation modes |
- Strict (Eager) |
- Lazy (Synchronous) |
Expand Down Expand Up @@ -60,7 +40,7 @@ object Pure {
- fs2 and Monix Task |
- All the evaluation modes |
- Performant |
- Tied to the larger framework |
- But Tied to the larger framework |

- Scalaz 7 IO |
- Doesn't really support asynchronous computation (i.e. callbacks) |
Expand Down
20 changes: 19 additions & 1 deletion assets/md/04_zio/PITCHME.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,22 @@ IO.syncException(FileUtils.readFileToByteArray(new File(name))): IO[Exception, A
def makeRequest(req: Request): IO[HttpException, Response] = IO.async(cb => Http.req(req, cb)) // Async IO
```

---?code=assets/src/future-vs-io/src/main/scala/example/FutureVsIO.scala&lang=scala&title=ZIO Console Example
+++?code=assets/src/future-vs-io/src/main/scala/example/FutureVsIO.scala&lang=scala&title=ZIO Console Example

+++
@snap[north]
@color[#eb4500](Fibers: Lightweight Concurrency Mechanism)
@snapend

```scala
val analyzed =
for {
fiber1 <- analyzeData(data).fork // IO[E, Analysis]
fiber2 <- validateData(data).fork // IO[E, Boolean]
... // Do other stuff
valid <- fiber2.join
_ <- if (!valid) fiber1.interrupt(DataValidationError(data))
else IO.unit
analyzed <- fiber1.join
} yield analyzed
```
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
@snapend

- Resource Management (File handles, JDBC Connections etc.)
- inter-op (Future, Task and Scalaz 7 `IO`)
- Scheduling
- Brackets
- Fibers
- Refs
Expand Down
11 changes: 0 additions & 11 deletions assets/md/05_inter-op/PITCHME.md

This file was deleted.

0 comments on commit 924c6e7

Please sign in to comment.