filmov
tv
fp-ts Tutorial | Chapter 3: Either

Показать описание
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
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
fp-ts Tutorial | Chapter 3: Either
fp-ts Tutorial | Chapter 3.1: Either tryCatch
fp-ts Tutorial | Chapter 3.3: Either flatMap (chain)
fp-ts Tutorial | Chapter 2.3: Option error handling
fp-ts Tutorial | Chapter 2: Option
fp-ts Tutorial | Chapter 2.2: Option fromPredicate
FP-TS Lesson 1 - Pipe
The fp-ts Either type
If I were starting with fp-ts in TypeScript
fp-ts Tutorial | Chapter 1: pipe and flow
Functional programming asyncronous tasks and error handling (part 3)
fp-ts Tutorial | Chapter 2.1: Option map, flatten, chain
When to use Do-Notation with fp-ts
FunctionalFest • TypeScript & FP: an introduction • Giovanni Gonzaga
Are you making the most of fp-ts Option?
Functional programming with Typescript using option, map, flatten, and chain (part 2)
Functional programming typescript with apply sequences and traversals
1.3 union types
Using Either to structure your validations
Функціональний TypeScript: fp-ts Either
Leveraging fp-ts Smart Constructors
FP-TS Lesson 5 - Do Notation (Do, bind, bindTo, apS)
【Explore STEM & Coding with EDU PICO】Chapter 3 - Part 2 | Introduction to Gesture Sensor
Fundamental composition technique: Pattern Matching in Functional Programming with TypeScript
Комментарии