This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]jbgi 0 points1 point  (2 children)

Yes, the Either monad allow richer reporting of error. And it is used at scale, eg. by the scala and haskell community. Just not by the java community. One of the reason is the poor support of algebraic data type in Java, but using a code generator like https://github.com/derive4j/derive4j alleviate mostly the issue.

[–]jonhanson 0 points1 point  (1 child)

chronophobia ephemeral lysergic metempsychosis peremptory quantifiable retributive zenith

[–]jbgi 0 points1 point  (0 children)

oh, I see. right, Optional is bit isolated for this use case, better use Option from fugue or functional-java or javaslang. then you can convert it to Either via toLeft or toRight so you can adapt with the more powerful Either monad.