DEV Community

Discussion on: Functional programming in typescript using fp-ts: ReaderTaskEither

Collapse
 
agiesey profile image
AGiesey • Edited

Can you discuss a little about pitfalls / complications / things to avoid when using Ether<E, A>? I'm new to them but we are starting to use them a lot at work. I'd like to make sure I don't do unforeseen things that will bite us later. Thanks!

Collapse
 
peerhenry profile image
peerhenry • Edited

I would say:

  1. Don't misuse Either - for example don't return a right when you have an error.
  2. Don't use Either when you neeed something else; a common use case is validation where you need to collect multiple validation errors instead of a single error. Checkout this article on Either vs Validation

Hope that helps, cheers!