Haskell type class morphism [OT]


#1

Recently I’ve seen an article, “Improving Typ e class Relations by Being Open”, by Guido Martínez et al.:

While it’s about Haskell, I think the same ideas could be adapted to Rust traits.

It introduces class morphisms, with a Haskell syntax like:

class morphism Enum -> Eq where
    x == y = fromEnum x == fromEnum y

The article lists some disadvantages and troubles with this idea, but in the whole it looks nice.