Skip to content
johnmcclean-aol edited this page Nov 21, 2016 · 4 revisions

Inclusive Or (can be one of Primary, Secondary or Both Primary and Secondary) as such it can behave either like a product (Tuple) or sum (either) type. As an Either or Union type, it is right biased. Primary and Secondary are used instead of Right & Left.

Right' (or primary type) biased disjunct union. No 'projections' are provided, swap() and secondaryXXXX alternative methods can be used instead.

Ior.<Integer,Integer>primary(10).map(i->i+1);
//Ior.primary[11]

Ior.<Integer,Integer>secondary(10).map(i->i+1);
//Ior.secondary[10]

Ior.<Integer,Integer>secondary(10).swap().map(i->i+1);
//Ior.primary[11]

Ior<String,Ingeger> kv = Ior.both("hello",90);
//Ior["hello",90]

See also Ior in Cats

Clone this wiki locally