fp-ts Tutorial | Chapter 3: Either

preview_player
Показать описание
In Chapter 3 of this fp-ts tutorial (functional programming in TypeScript), we will introduce the Either type, which is used to represent the result of a computation that can fail.

Traditionally, you don't have any indication in the type system that a function might throw, and when you catch errors in a try/catch block, you just get an error with type 'unknown', which is not helpful at all!

With the Either type, however, you can have fully type-safe errors! In the sense that not only you know that a function might fail but you also get fully-typed errors!

Furthermore, we will see how to enforce the handling of all errors in the type system by doing pattern matching on errors using the ts-adt library.

00:00 Errors with try/catch
00:14 Type-safe errors
00:31 Either definition
01:44 Either visualization
02:19 Example
04:24 Either vs throwing error
05:05 Either pattern matching
06:00 Error pattern matching
Рекомендации по теме
Комментарии
Автор

I've recently switched from mobile development to backend development for the company I work for. We use fp-ts, this videos are really helpful, thank you!

mariotavera
Автор

Concise and to the point. Keep up the good work 💯

tanishqmanuja
Автор

your video series are awesome, very nice to see and easy to follow. Love them. Thanks, thanks

Danielo
Автор

Lol i made schema module for kirka yesterday and you made video about error unions in fpts 😅 you doing insane work bro! Keep going! You can even try to ask fpts team to put your videos in their docs!!! 😮😮😮 Thank you

CuriousSpy
Автор

please continue with the series, including less known data types from fp-ts. i have a feeling everybody starts with Option and Either but then are kind of stuck/lost how to incorporate other patterns

dzigizord
Автор

this was very helpful, i hope you really keep creating such content ♥

khalilchermiti
Автор

Btw, I love your font colors, close to the colors I use in VS Code and Intellij IDEA :)

treseymour
Автор

Hey, can you tell why checkout function is a function which returns another function and not just a function which takes two params, account and cart OR a single param with both account and cart? I think I am having difficulties grasping core concepts of FP.

AdityaKumar-jjcq
Автор

Content is great!! But it is a bit difficult to understand. I guess maybe because i loose the link between the code that you are explaining since at a given point only a small snippet of code is visible. I am unable to refer the previous code snippets

yogeshmurarka
Автор

Why use ts-adt when you can use an exhaustively-checked switch statement?

Christian-onjg