简体   繁体   中英

when use "Either in fp-ts" for front-end develop?

tldr: I want to know when to use "either" except network I/O.

In my understanding, Either is used when distinguishing success from fail.

So I use "Either" when network request that may fail.

there are any case other case to use Either in front-end developing? In a different question, there are any case that may fail?

thank you

Giulio provides a nice little terse guide for mapping some common problems that arise in imperative code with how they can be dealt with using fp-ts . There you will see there network IO challenges are often solved using a TaskEither . You will also see that the Either type maps well to any synchronous API that may throw.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM