valenterry valenterry - 3 months ago 22
Scala Question

Is there a shortcut for Disjunction.fold(identity, identity)?

I have a scalaz

Disjunction
with the same types like
Disjunction[String, String]
and I just want to get the value, whatever it is. I therefore used
myDisjunction.fold(indentity, identity)
but I wonder, is there a shortcut like
myDisjunction.safeGetBecauseTypesAreEqual()
?

Lee Lee
Answer

You can use merge:

val s: String = myDisjunction.merge()
Comments