4 ms·
Why can't we just use `Either` or ADT
by minebreaker 2y ago
Why can't we just use `Either` or ADT
- wk_end 2y agoWith TypeScript a nullable return type effectively is an ADT.
- seniorsassycat 2y agoBut it's not Either / Result because there no error information on null
- tengbretson 2y agoThen return something else.
- maxbond 2y agoYou might be interested in `fp-ts` (and the related `io-ts`). https://gcanti.github.io/fp-ts/ https://gcanti.github.io/fp-ts/ https://gcanti.github.io/io-ts/ https://gcanti.github.io/io-ts/
- adregan 2y agoI’ve never gone so far as to pull in fp-ts into a work codebase because it often doesn’t feel that it’s worth the headache of arguing for it. However, I check back in from time to time and was recently confused as to whether or not the community has moved onto effect-ts as it seems effect consumed the fp project? Do you have any context on that?
- maxbond 2y agoNo sorry, I'm not tuned in to typescript at the moment. I've mostly used fp-ts in the past because I haven't found a better runtime type system than io-ts, but I haven't written typescript in a while. Mostly responding so people with better context don't wait on me.
- mrkeen 2y agoWe can and do.