julian
08/23/2020, 6:48 PMOption
map2
, one provides a lambda that handles the case where both values are Some
. But what if one wants to provide a lambda for all four possible cases? I can do this from scratch. But I wondered if there's a higher order function in Arrow that's already designed for this.raulraja
08/23/2020, 7:53 PMDanilo Herrera
08/23/2020, 8:36 PMJannis
08/23/2020, 9:01 PMIor.fromOptions(optA, optB).fold(...)
which gives you an Option<Ior<A, B>>
which should cover all cases. Alternatively we have a pr by @pablisco (who might be interested in this use-case) for a datatype just like the one @Danilo Herrera has in his gist, which can do this in just two steps (convert + fold instead of convert + fold + fold for the Ior one). The pr is here for those interested: https://github.com/arrow-kt/arrow-incubator/pull/109julian
08/23/2020, 9:08 PM