Disjunction.fold(identity, identity) 有快捷方式吗?
Is there a shortcut for Disjunction.fold(identity, identity)?
我有一个 scalaz Disjunction
,其类型与 Disjunction[String, String]
相同,我只想获取值,无论它是什么。因此我使用了 myDisjunction.fold(indentity, identity)
但我想知道,是否有像 myDisjunction.safeGetBecauseTypesAreEqual()
这样的快捷方式?
您可以使用 merge
:
val s: String = myDisjunction.merge()
我有一个 scalaz Disjunction
,其类型与 Disjunction[String, String]
相同,我只想获取值,无论它是什么。因此我使用了 myDisjunction.fold(indentity, identity)
但我想知道,是否有像 myDisjunction.safeGetBecauseTypesAreEqual()
这样的快捷方式?
您可以使用 merge
:
val s: String = myDisjunction.merge()