Quill
Compile-time
Language
Integrated Queries
https://github.com/zio/zio-quill
Slide 8
Slide 8 text
Monadless
Syntactic sugar
for monads
https://github.com/monadless/monadless
Slide 9
Slide 9 text
When your hobby
becomes your
worry …
It’s time for a break!
Slide 10
Slide 10 text
A decade working on
large-scale systems
● SoundCloud, Twitter, Nubank
● Delivered major performance
optimizations for Finagle, Twitter
Future, Stitch, Graal, Clojure
● Saw hundreds of crashes
Scala — Graal
ScalaMatsuri 2019
https://youtu.be/a6dK3eXhO7k?si=T775S1sKFu5B4wSf
Slide 11
Slide 11 text
Functional
Programming is
great
Slide 12
Slide 12 text
Functional
Programming is
great (but terrible)
Slide 13
Slide 13 text
Interpretation
overhead
User-level interpreted language
Highly dynamic execution
High allocation rate
Slide 14
Slide 14 text
Code complexity
Slide 15
Slide 15 text
Innovation
begins with
broken rules
Slide 16
Slide 16 text
ZIO[R, E, A]
Slide 17
Slide 17 text
ZIO[R, E, A]
type IO[+E, +A] = ZIO[Any, E, A]
type Task[+A] = ZIO[Any, Throwable, A]
type RIO[-R, +A] = ZIO[R, Throwable, A]
type UIO[+A] = ZIO[Any, Nothing, A]
type URIO[-R, +A] = ZIO[R, Nothing, A]
Slide 18
Slide 18 text
ZIO[R, E, A]
Do we really need a fixed arity?
Why assume the computation uses IO and Async?
Why only dependency injection and short-circuiting?
What if we could express an unbounded number of effects?
Slide 19
Slide 19 text
Let’s break
the rules
again :)
Slide 20
Slide 20 text
ZIO[R, E, A]
Slide 21
Slide 21 text
A > (R & E)
Slide 22
Slide 22 text
A > (Envs[R] & Aborts[E])
Slide 23
Slide 23 text
A > Aborts[E]
Slide 24
Slide 24 text
A > Any
Slide 25
Slide 25 text
A > Any
A pure value 😱
Slide 26
Slide 26 text
A > (Envs[Database] & Aborts[DBException])
Slide 27
Slide 27 text
A > (Envs[Database] & Aborts[DBException] & IOs)
Slide 28
Slide 28 text
type Databases = Envs[Database] & Aborts[DBException] & IOs
A > Databases
Slide 29
Slide 29 text
type Caches = Envs[Cache] & IOs
type Databases = Envs[Database] & Aborts[DBException] & IOs
A > (Databases & Caches)
Slide 30
Slide 30 text
type Caches = Envs[Cache] & IOs
type Databases = Envs[Database] & Aborts[DBException] & Caches
A > Databases
Slide 31
Slide 31 text
Leveraging
Scala’s advanced
type system
Slide 32
Slide 32 text
A > (Envs[Database] & Aborts[DBException] & IOs)
Slide 33
Slide 33 text
A > (Aborts[DBException] & Envs[Database] & IOs)
Slide 34
Slide 34 text
A > (Aborts[DBException] & IOs & Envs[Database])
Unordered Pending Effects
Slide 35
Slide 35 text
opaque type >[+T, -S]
Original Design
Slide 36
Slide 36 text
opaque type >[+T, -S] = T | Kyo[_, _, _, T, S]
Original Design
Slide 37
Slide 37 text
opaque type >[+T, -S] = T | Kyo[_, _, _, T, S]
Original Design
Implicit conversions
from/to T > Any and T
Slide 38
Slide 38 text
opaque type >[+T, -S] = T | Kyo[_, _, _, T, S]
After Scala 2 support
Slide 39
Slide 39 text
type >[+T, -S] >: T
After Scala 2 support
Slide 40
Slide 40 text
type >[+T, -S] >: T
After Scala 2 support
Any type T is a subclass of T > Any
Slide 41
Slide 41 text
type >[+T, -S] >: T
After Scala 2 support
Any type T is a subclass of T > Any
val a: Int > Any = 1
val b: Int = a.pure
Slide 42
Slide 42 text
Effect Widening
val a: Int > Any = 1
Slide 43
Slide 43 text
Effect Widening
val a: Int > Any = 1
val b: Int > Options = a
Slide 44
Slide 44 text
Effect Widening
val a: Int > Any = 1
val b: Int > Options = a
val c: Int > (Options & Tries) = b
Slide 45
Slide 45 text
Effect Widening
val a: Int > Any = 1
val b: Int > Options = a
val c: Int > (Options & Tries) = b
val d: Int > (Options & Tries) = 42
Kyo’s
throughput is
249% higher
than the best contender
(average across benchmarks)
Slide 73
Slide 73 text
Overhead-free abstraction
Slide 74
Slide 74 text
Overhead-free abstraction
Slide 75
Slide 75 text
Overhead-free abstraction
Slide 76
Slide 76 text
High-performance
asynchronous
primitives
Slide 77
Slide 77 text
High-performance
asynchronous
primitives
Slide 78
Slide 78 text
High-performance
asynchronous
primitives
Slide 79
Slide 79 text
Low-overhead
Fibers
(only 32B
each!)
Slide 80
Slide 80 text
Low-overhead
Fibers
(only 32B
each!)
Slide 81
Slide 81 text
Low-overhead
Fibers
(only 32B
each!)
Slide 82
Slide 82 text
Blazing-fast channels
Slide 83
Slide 83 text
Blazing-fast channels
Slide 84
Slide 84 text
Blazing-fast channels
Slide 85
Slide 85 text
How about
Caprese?
Slide 86
Slide 86 text
Caprese
Kyo delivers
Caprese’s
key promises
Slide 87
Slide 87 text
Caprese
Kyo delivers
Caprese’s
key promises
without language
changes
Slide 88
Slide 88 text
Caprese
Kyo delivers
Caprese’s
key promises
without language
changes,
with a complete set of
effects
Slide 89
Slide 89 text
Caprese
Kyo delivers Caprese’s
key promises
without language
changes,
with a complete set of
effects
and next-level
performance
Slide 90
Slide 90 text
Caprese
Kyo delivers Caprese’s
key promises
without language changes,
with a complete set of
effects
and next-level
performance
in Scala 2, 3, and JS
Slide 91
Slide 91 text
Caprese
Kyo delivers Caprese’s
key promises
without language changes,
with a complete set of
effects
and next-level performance
in Scala 2, 3, and JS
today
Slide 92
Slide 92 text
CREDITS: This presentation template was created
by Slidesgo, and includes icons by Flaticon and
infographics & images by Freepik
Thanks!
Any questions?
https://getkyo.io
https://dev.to/fwbrasil
@fbrasisil