Skip to content

What is the most popular optional / alternative monad? #1202

Answered by bmazzarol
davidyu2023 asked this question in Q&A
Discussion options

You must be logged in to vote

Always pick the Monad that provides the most limited set of guarantees required to accomplish the goal.

If all you need is to detail that a function might not return a value, but will never fail, just use Option.

If you want to outline that it can return 1 of 2 values, use Either.

If you want to describe a function that returns 1 or many failures, use Validation. (This one should not come up as much)

I would recommend looking through the API documentation, its all very good.

IMHO, the async variants of Either, Options and Try are all a mistake. If you want an effect monad, use Eff and Aff.

More than happy to talk to more specific cases and then talk through why a particular Monad might be…

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
1 reply
@davidyu2023
Comment options

Comment options

You must be logged in to vote
6 replies
@CK-LinoPro
Comment options

@louthy
Comment options

@CK-LinoPro
Comment options

@bmazzarol
Comment options

@davidyu2023
Comment options

Answer selected by davidyu2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants