assertRankSorted = (sorted, compare) =>
  isRankSorted(sorted, compare) ||
  // TODO assert on bug could lead to infinite recursion. Fix.
  // eslint-disable-next-line no-use-before-define
  Fail`Must be rank sorted: ${sorted} vs ${sortByRank(sorted, compare)}`
@param {Passable[]} sorted
@param {RankCompare} compare