Why PartialEq and PartialOrd have not generic Output types?


While standard operator traits, like Add, BitAnd or Mul have generic Output types, operator traits for comparisons are restricted to bool results.
DLS APIs could be benefited from generic output types in comparators, having a trait definition like:

pub trait PartialEq<Rhs = Self> where Rhs: ?Sized {

// you could still translate Output to bool
type Output: Into<bool>; 
fn eq(&self, other: &Rhs) -> Self::Output;
fn ne(&self, other: &Rhs) -> Self::Output { ... }


With the current approach, in DLS APIs like Diesel, you must use methods to representate “equals” operator:


With generic output types, you could use

posts.filter(published == true)


Then everywhere else which wants to use PartialEq for boolean conditionals, which is probably more common, would have to specify PartialEq<Output=bool> in their bounds. That’s already pretty annoying to deal with in the other operator traits.


Sure, just in case that type defaults become stable, you could improve PartialEq in this way, without lose backward compatibility nor ergonomics.