OptionOrd<A> constructor

OptionOrd<A>(
  1. Ord<A> ord
)

Implementation

OptionOrd(this.ord)
    : super((Option<A> x, Option<A> y) {
        if (identical(x, y)) return 0;

        switch (x) {
          case None():
            return (y is Some<A>) ? -1 : 0;

          case Some(value: var someValueX):
            return match<A, int>(() => 1,
                (someValueY) => ord.compare(someValueX, someValueY))(y);
        }
      });