-
Hello, I try to slowly introduce LanguageExt in my project and I'm not sure if Either and Result are the same thing. When should we use one over the other ? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Writing this response on my phone, so apologies for brevity and lack of markup/formatting. Never use Result is the short answer. Result may be deprecated at some point (because this question comes up a lot and clearly causes confusion), mostly because it was only ever designed as an intermediate type for Try, not as a fully fledged monadic type (like Either or Fin) That's also the reason it sits in a different namespace, so it wouldn't be used accidentally; and so it wouldn't cause naming conflicts with other libraries that use Result (very common name).
So Fin is the one to use 👍 (I notice you're French, so I hope you appreciate the etymology too 😉) |
Beta Was this translation helpful? Give feedback.
Writing this response on my phone, so apologies for brevity and lack of markup/formatting.
Never use Result is the short answer. Result may be deprecated at some point (because this question comes up a lot and clearly causes confusion), mostly because it was only ever designed as an intermediate type for Try, not as a fully fledged monadic type (like Either or Fin)
That's also the reason it sits in a different namespace, so it wouldn't be used accidentally; and so it wouldn't cause naming conflicts with other libraries that use Result (very common name).
Fin<A>
is actually closer toResult<A>
, it is likeEither<Error, A>
. It's called Fin to be short and easy to use, unlikely to conflict w…