A New Library For Imperative ZIO Programming by Alexander Ioffe

preview_player
Показать описание
"A New Library For Imperative ZIO Programming" by Alexander Ioffe at Functional Scala 2022.

Scala's for-comprehensions are good at saving us from flatMap chains but the second we need to do branching, looping, case-matching, or error-handling they have nothing to offer. This means that every single one of these constructs needs a different functional-programming solution than the one we've learned in Computer Science 101, and every single FP-aspiring programmer needs to learn them from scratch.

In the Monadless library, Flavio Brasil re-imagined this scenario. What if a developer could write in the (regular) direct-style of programming and their code could automatically be re-written to the functional style? What if the traditional programming constructs that we are all familiar with could be used to write functional programs? Indeed with the power of Scala meta-programming these things are possible and within our grasp!

ZIO-Direct takes this approach one step further by incorporating ZIO's unique error-handling and dependency-injection mechanisms into the Monadless paradigm. This gives us a programming construct much more powerful than the for-comprehension, that is equipped to handle the many needs of IO programming. With this tool, we can write the next generation of functional programs, and bring FP to the many domains of the software world.

Slides Available here:

Contents in the video:

0:15 Is Functional Programming With Effect Systems Easy?
12:26 Wouldn’t Everyone Want This?
15:05 ZIO-Direct
20:53 Correctness
26:05 Argument 1: It Is Not Referentially Transparent
28:52 Argument 2: It Is Lawless
30:00 Error Channels
33:27 Using Refs
36:38 In Summary

#FunScala2022 #scala #zio #functionalprogramming #functionalscala #scalaconference #scaladeveloper
Рекомендации по теме
Комментарии
Автор

Great library, and presentation!
Cracking the problem of better for-comprehension syntax for effects will be hugely empowering - a game changer for ZIO, and therefore Scala.

pdf
Автор

Fantastic. The combination of FP and OOP in Scala has come a long way, but still carries the Haskell type ideas. Zio seems to be at the heart of practical computer programming science today and this kind of cutting edge development keeps pushing the cutting edge. Love it.
At some point Zio and Scala have to have a greater meeting of the minds and maybe that will slim down Scala to something more integrated and perfect.

markhathaway
Автор

Jesus, its brilliant!
next step - write your own Zlang, which would eliminate coloring and need for defer/run.

artemsokolov
Автор

Wouldn't be a ZIO talk without the misplaced 3 minute long rant about everyone else being dumb and wrong and stuck in the past. Can zio-direct do automatic coloring, non-local early returns, higher-order functions? I thought not. dotty-cps-async can do all of the above, including inference of error union types, not only for ZIO but for _all_ monads (that implement the corresponding typeclass).

rcts