asMeetPartialOrder method
Given Eq<T>
, return a PartialOrder<T>
using the combine
operator of Semilattice
to determine the partial ordering. This method assumes
combine
functions as meet
(that is, as a lower bound).
This method returns:
- 0.0 if
x == y
- -1.0 if
x == combine(x, y)
- 1.0 if
y == combine(x, y)
null
otherwise
Implementation
PartialOrder<T> asMeetPartialOrder(Eq<T> eq) => PartialOrder.from(
(x, y) {
if (eq.eqv(x, y)) {
return 0;
}
final z = combine(x, y);
return eq.eqv(x, z)
? -1
: eq.eqv(y, z)
? 1
: null;
},
);