Simple Functional Effects with Tag Unions • Richard Feldman • YOW! 2022

  Рет қаралды 9,451

GOTO Conferences

GOTO Conferences

Күн бұрын

This presentation was recorded at YOW! 2022. #GOTOcon #YOW
yowcon.com
Richard Feldman - Functional Programming Language Expert & Author of “Elm in Action”
RESOURCES
/ rtfeldman
github.com/rtfeldman
/ rtfeldman
ABSTRACT
There are many ways a programming language can support effects. For many years, side effects were the only game in town. Today, there are a variety of ways to model effects in a more functional way, with each effect system having its own set of tradeoffs.
This talk introduces a simple, high-performance effect system based on tag unions - which can be implemented in the Roc programming language, as well as in #OCaml using #polymorphic variants. The system allows for easily mixing I/O operations that can fail in different ways (such as HTTP requests and file I/O), while still offering exhaustiveness checking on all the error cases. It also makes it easy to tell which functions are using which effects (for example, "this part of the code base does HTTP and reads from the filesystem, but is guaranteed not to write to the filesystem"), and to enforce at compile time that certain calls may result in some effects but not others.
If you're interested in a simple, high-performance effect system with these characteristics, come see what it's all about in this talk! [...]
Download slides and read the full abstract here:
yowcon.com/sydney-2022/sessio...
RECOMMENDED BOOKS
Richard Feldman • Elm in Action • amzn.to/387kujI
Tim McNamara • Rust in Action • amzn.to/3ux2R9u
Jeremy Fairbank • Programming Elm • amzn.to/2WhZCE8
Wolfgang Loder • Web Applications with Elm • amzn.to/3jblQ3q
Cristian Salcescu • Functional Programming in JavaScript • amzn.to/3y75jBS
/ gotocon
/ goto-
/ gotoconferences
#FunctionalProgramming #FP #Elm #ElmInAction #Elmlang #TagUnions #RichardFeldman #SoftwareEngineering #Programming #SoftwareDevelopment #YOWcon
Looking for a unique learning experience?
Attend the next GOTO conference near you! Get your ticket at gotopia.tech
Sign up for updates and specials at gotopia.tech/newsletter
SUBSCRIBE TO OUR CHANNEL - new videos posted almost daily.
kzbin.info...

Пікірлер: 20
@paryoticu
@paryoticu 8 ай бұрын
Roc is getting an effect system, which will be async-capable and will use continuation-passing-style. Wow, terrific news if I understood correctly. Great presentation as always rtfeldman.
@csbnikhil
@csbnikhil Жыл бұрын
For Rust though, map_err calls can be avoided. But that will come at the cost of writing std::convert::From implementations for each.
@angeloceccato
@angeloceccato Жыл бұрын
I like the effect system + the row polimorphism of Roc 😍
@ShawnShaddock
@ShawnShaddock Жыл бұрын
Great video, Roc sounds really cool!
@minecraftermad
@minecraftermad Ай бұрын
missed chance to mention zig :)
@humanlytyped
@humanlytyped Жыл бұрын
This is exactly final encoding vs initial encoding. With algebraic data types, we can pair initial encoding with the interpreter pattern to obtain extensible effects. OOP simulates sum types using ad-hoc polymorphism, so we can pair final encoding and the decorator pattern to obtain extensible effects. I like how Roc automatically extends the tags returned from a function. There is probably an analogue in OCaml, I think it's row polymorphism.
@csbnikhil
@csbnikhil 9 ай бұрын
In OCaml, Polymorphic Variants enable Row Polymorphism.
@humanlytyped
@humanlytyped Жыл бұрын
35:07 isn't this part a monadic bind?
@pdp11
@pdp11 3 ай бұрын
That's just an artefact of the fact that effects can be encoded by monads.
@renghenkow
@renghenkow Жыл бұрын
very similar to what nim has as an effect system
@aloussase
@aloussase Жыл бұрын
Do syntax would avoid all those Task.await. Event F# has something like that with computation expressions.
@markhamburg5535
@markhamburg5535 7 ай бұрын
How easy does Roc make it to specify that a piece of code is only allowed to perform some effects but not others? For example, could one specify that when running a database transaction we would allow access to the local file system but not to the network in order to limit task latency while holding a connection open on the database? Presumably this would show up as an explicit type for the third type argument for Task? Would the Roc compiler then present an error at the point where you tried to perform a disallowed task or would it error out at the point where the type was explicitly specified?
@JT-mr3db
@JT-mr3db Жыл бұрын
This looks very similar to how Parser combinators work. Parsers returning parsers.
@MaksimVolkau
@MaksimVolkau 11 ай бұрын
Scala3 ZIO in Roc but without the environment, right?
@walrustrent2001
@walrustrent2001 7 ай бұрын
The non-capabilities seem like capabilities to me. Effects are specific beasts that need to be distinguished from purely functional code as much as possible.
@Mik1604
@Mik1604 10 ай бұрын
How is map_err specifically used for Errors only? It seems to me like something like map_type is much more generic and useful.
@Qrzychu92
@Qrzychu92 9 ай бұрын
it's basically monadic bind (your map_type), but for the error path of the code instead of success
@MarkusBurrer
@MarkusBurrer 2 ай бұрын
Is IT possible to do the same Thing in Rust?
@user-uf4rx5ih3v
@user-uf4rx5ih3v 2 ай бұрын
Yes it is. But I imagine it wont be as ergonomic as this because you would have to implement the Task monad manually everywhere. Most of the functional features of Rust are first class because otherwise using them is not nice. Perhaps if you could derive Task automatically with macros but I'm not a big Rust expert so I don't know.
Why Static Typing Came Back • Richard Feldman • GOTO 2022
52:01
GOTO Conferences
Рет қаралды 149 М.
Why Isn't Functional Programming the Norm? - Richard Feldman
46:09
Мы играли всей семьей
00:27
Даша Боровик
Рет қаралды 5 МЛН
Зомби Апокалипсис  часть 1 🤯#shorts
00:29
INNA SERG
Рет қаралды 7 МЛН
Зу-зу Күлпәш.Курс (6 бөлім)
40:48
ASTANATV Movie
Рет қаралды 574 М.
НЕОБЫЧНЫЙ ЛЕДЕНЕЦ
00:49
Sveta Sollar
Рет қаралды 8 МЛН
Just-in-time Architecture • Macklin Hartley • YOW! 2022
54:37
GOTO Conferences
Рет қаралды 11 М.
Elm crash course - Building unbreakable webapps fast
45:53
freeCodeCamp.org
Рет қаралды 97 М.
Stop Calling Your API a "REST API"
17:42
Amichai Mantinband
Рет қаралды 11 М.
Introduction to Roc Programming Language by Richard Feldman
1:04:12
Func Prog Sweden
Рет қаралды 10 М.
Minimum Viable Architecture • Randy Shoup • YOW! 2022
47:40
GOTO Conferences
Рет қаралды 49 М.
[Haskell'23] The Evolution of Effects
1:06:11
ACM SIGPLAN
Рет қаралды 4,7 М.
The power button can never be pressed!!
0:57
Maker Y
Рет қаралды 44 МЛН
Обманет ли МЕНЯ компьютерный мастер?
20:48
Харчевников
Рет қаралды 150 М.
Any Sound & Call Recording Option Amazing Keypad Mobile 📱
0:48
Tech Official
Рет қаралды 325 М.
Распаковка айфона в воде😱 #shorts
0:25
Mevaza
Рет қаралды 1,5 МЛН
Готовый миниПК от Intel (но от китайцев)
36:25
Ремонтяш
Рет қаралды 407 М.