raulraja
12/17/2017, 2:18 PMyields
is optional. You can just return any value that matches the type signature of the monad binding. If you are seeing red lines it probably means the expression does not compile. A valid return value for example would be in the case of Either.binding
any Left
or Right
value that matches the parametrization of L
. The only thing yields
does is lifting the value to the type contructor of the monad you are comprehending over via Applicativ#pure
. Feel free to post the snippet where there are redlines without yields
. That should not happen if it compiles.