Skip to content
0:00 / 0:00

#catseffect#effectsystems#iomonad

Keynote: Daniel Spiewak - The Case For Effect Systems

Konfy

4K subscribers • 14 videos on Hallway

YouTube
  • Recommended by 1 person: 1 in engineering communities.
  • Presented by Daniel Spiewak
  • An opinion. It argues one side of a question engineers disagree on.

Advanced. Deep dive for people who know the field.

17K views4 years ago1 recommendation

Programming languagesSystems programmingScalaConcurrency and parallelismFunctional programming

Daniel Spiewak explains the performance, reliability, and architectural benefits of using effect systems on the JVM.

Scaling and stabilizing cloud services in the face of torrential volumes of traffic is one of the major problem spaces that defines our language ecosystem. Problems such as reliability, predictability, throughput, efficiency, self-healing, and such are the primary factors which largely dictate both architectural and implementation decisions. In this talk, we will peel apart how these factors manifest on the JVM, ultimately motivating not only the asynchronous I/O paradigm in general but effect systems in particular, with a special emphasis on performance and efficiency in the real world. 2022.scala.love twitter.com/scala_love

Why it's here

1 person recommends this

What people say. Engineers recommend this talk for its deep explanation of why effect systems outperform Futures under heavy load.

Moments people linked to

u/The-_Captainin r/scala • Recommends

Why are effects better for retries than Future? I am watching this great talk by Daniel Spiewak motivating effects. In particular, there is a point where he mentions that you can't do retries with Future, but you can with effects. Of course you literally can do retries with futures (e.g. here), but you risk repeating side-effects that aren't properly contained in a transaction. Why is this not the case for effects? Example: say I want to log a statement then read a value from a database. In the case of a future retry, suppose the first attempt logs successfully then fails to read. The retry logs the statement again then reads from the database (successfully), resulting in two logs instea…

u/chayatourein r/scala • Mentions

On “Why Effects libs?”

Daniel spiewak has a really good talk on that exact question: link to this video Side note, all his talks are super interesting and compelling, highly recommend.

u/DisruptiveHarbingerin r/scala • Mentions

On “Why Effects libs?”

You'll find several talks on YouTube that explain the why, e.g. * [video * [video From a more practical point of view, in a typical web service I want at least: * Resource acquisition and release * Concurrent IO, either async or blocking * Streaming * Parallelization sometimes Cats Effect and Zio provide a nice API to achieve that without shooting myself in the foot, unless I really try hard to. Regarding function coloring, you mentioned Akka, it's fundamentally the same. As soon as you touch Akka you have Futures everywhere. In both cases you have pure functions and the plumbing wrapped in a monad, and Scala's own Future is the least pleasant to work with.

u/lionflzcfxpcuugdshin r/scala • Mentions

Elaborating on the load shedding claims in "effect system" aka IO monad TLDR - how to make sure my server written in IO doesnt die when load spikes. Also how to not have latency spikes but instead return errors when server limits are reached So in his talk The Case For Effect Systems Spiewak says something(its timestamped) like "I had a service that could handle 100 connection and then when it got a 1000 it didnt crash because it was written with IO and Resource" and doest really elaborate on why that was the case From my point of view its very easy to have such guaranties in "1 thread per request" model since all you have to say is "this thread pool of size 100 will handle http conne…
12View on Reddit

u/KagakuNinjain r/scala • Mentions

On “How can I learn the type level , correctness, and compile-time error checking of the scala language?”

I recommend these Daniel Spiewak videos: Threads at Scale, an excellent introduction to performance issues of threads on the JVM. Case for Effect Systems, explains why we need effect systems like Cats Effect and ZIO. Java 21 virtual threads provide some of the benefits, but not all.

u/Seth_LightbendScala teamin r/scala • Mentions

On “Help me understand about effects”

Daniel Spiewak's “The Case for Effect Systems” talk (2022) is excellent: link to this video

u/caverweniin r/Clojure • Mentions

IO/async monad without the indirect monadic style: Possible? needed? Hi, I'm newish to Clojure, mostly trying to find solutions for shortcomings of other approaches I gained before. My background is in Scala, and I'm exploring ways to move away from it because I think a lot of the complexity that teams and the community generally speaking brings in doesn't pull its weight. One particular area where I thought this is the case is doing all IO in a monad, which results in far less straightforward monadic code compared to the usual approach. --- Recently there has been an exchange of opinions on the issue that made me realize a couple of things: * moving away from an IO monad ridden lan…

u/Daenythin r/functionalprogramming • Mentions

On “What developments have there been in FP over the last 10 years?”

One of the big trends is monadic effect systems becoming more mainstream. Things like rust's tokio and scala's cats-effect provide a very strong foundation for building concurrent applications in a functional way link to this video

u/BalmungSanin r/scala • Mentions

On “Why would I wrap logging into an effect?”

Not sure if the question is about just logging, or about _"using `IO` in general"_. If the former, then rather than trying to explain it poorly I would rather redirect you to both the _"Programs as Values"_ series from Fabio: https://systemfw.org/archive.html and the amazing talk _"The case for effect systems"_ by Daniel: link to this video The TL;DR; is that doing so enables you a different programming paradigm where the logic of your programs becomes data structures that you can manipulate easily through combinators / methods. That gives you a lot of power and control over the execution flow; traditional examples of what you may do include, cancellation, retrying, rate limiters, back pressure, expl…
4View on Reddit

u/BalmungSanin r/scala • Mentions

On “http4s”

…cuted in the main; where those principles not longer matter. Such type is the `IO` data type _(which also forms a `Monad`)_. If you are interested in learning more about this different programming paradigm, check the _"Programs as Values"_ series from Fabio: https://systemfw.org/archive.html and the talk _"The case for effect systems"_ by Daniel: link to this video Now, **http4s** is basically just an HTTP library built on top of those ideas and data types. But, if you are not sold in those there is no point in using it. I would rather recommend playing with `IO` first, you may use it in the current project with some conversions here and there. And, if you end up liking it then you may start a new p…

u/BalmungSanin r/scala • Mentions

On “how do Scala libraries like CatsEffects and ZIO manage to get green threads without JVM support?”

Hi, not a good one to be honest. The latest talk from Daniel about effect systems gives a brief explanation of what are `Futures`: link to this video but he quickly points out the flaws with them and proceeds to explain `IO` Maybe one of the **coursera** courses would go into detail? perhaps this one: https://www.coursera.org/learn/effective-scala but I didn't do it. In general, the idea is straightforward when you do something like `Future { ... }` the compiler lifts the body into a thunk _(a function of no arguments)_ and then passes that to the `apply` method of `Future`, which then immediately registers that thunk to the execution context it has available. And `ExecutionContext` is basically a…

u/ResidentAppointment5in r/scala • Mentions

On “"A New Library For Imperative ZIO Programming" by Alexander Ioffe at Functional Scala 2022”

IMO, Daniel Spiewak answers your last question well here. I would summarize as: even for concurrency you want a better abstraction than `Thread`, and monads are about _much_ more than just concurrency.

u/Mysterious_Elk8467in r/scala • Mentions

On “The Great Concurrency Smackdown: ZIO versus JDK by John A. De Goes”

Indeed; this seems to me like John's version of Daniel Spiewak's "The Case for Effect Systems".

u/BalmungSanin r/scala • Mentions

On “What do you think are the defining features that make Scala uniquely better than other languages?”

> do you have any advice on resources to dive deeper? + https://systemfw.org/archive.html + link to this video + https://github.com/Daenyth/intro-cats-effect > I'm trying to understand how (and if) the "Programs as Values" approach is different from the 'code as data/data as code' approach that you see in Lisp-like languages I am not very familiar with the **Lisp** pattern but AFAIK it is very different. The code as data pattern, AFAIK _(I may be confusing it with something else)_ is more about meta-programming and data manipulation. Whereas programs as values is more about how to write safer imperative programs in a concurrent environment. However, both have something in common, that values and R…

u/jivesishungryin r/scala • Mentions

On “Advice on Monads and other FP concepts”

I think working with simple monadic types for a while is good way to see why they're useful, but if you want a general case for monadic effects that's easy to digest, here is my favorite: [video (Daniel Spiewak).

u/KagakuNinjain r/scala • Mentions

On “Did you guys think that?”

Some large telcos and streaming media companies use Scala, you don't hear about it much. Examples are Comcast, Verizon and Disney Streaming. The Typelevel stack is extremely performant, and can scale with no problems. It gives you a highly expressive pure FP API. Cats Effect 3 is inspired by Tokio, and optimized to make efficient use of small thread pools, if you are able to avoid blocking IO. This is in contrast to the traditional Java approach of large thread pools and blocking IO (Java 21 obviously changes things, but from what I have read, virtual threads still have some serious footguns). The ZIO library is also popular. You might watch some Daniel Spiewak videos, he explains it much…