loading...

re: Implementing a Ternary Operator in Scala VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Fair enough! So what you're saying is you'd have the ifTrue and ifFalse themselves return Eithers, if necessary, like (3 < 2) ? Left(42) |: Ri...

That is a good example to ensure type consistency with minimal effort, you don't need |: and &: at the same time and achieve the same result (Option[Either[T, F]]).

One of my main point here is do not over obsess with data type generalization and construct unnecessary structures.

code of conduct - report abuse