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!
Don't misuse Either - for example don't return a right when you have an error.
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!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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!
I would say:
Either
- for example don't return aright
when you have an error.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 ValidationHope that helps, cheers!