-
Notifications
You must be signed in to change notification settings - Fork 0
These
Artūras Šlajus edited this page Oct 31, 2016
·
1 revision
These<A, B>
is a niche data structure that says A or B or (A and B)
.
Usually it is used when you'd want to pass two options, but (None, None)
does not make sense.
var opt1 = returnsOpt1();
var opt2 = returnsOpt2();
var theseOpt = These.a(opt1, opt2);
foreach (var these in theseOpt) doSomething(these);
-
#thisValue
returnsOption<A>
if left is set. -
#thatValue
returnsOption<B>
if right is set. -
#bothValue
returnsOption<Tpl<A, B>>
if both sides are set.
You can also map
or flatMap
over These
.