filmov
tv
A New Library For Imperative ZIO Programming by Alexander Ioffe
Показать описание
"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
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
Комментарии