The Cats library
This is how to learn proper abstraction techniques.
Standard mathematical (algebraic) abstractions as Scala 3
type-classes (composed or nested Traits).
Notice that only Functor-ial and Monoid-ial are practical.
Type-classes (being named sets of interfaces) are as fundamental in programming as Sets and Logic in mathematics.
Generalized algebraic structures (which emerge more than once in different branches of mathematics) are in some sense proper abstractions, just like Sets themselves.
This is the peak of a good style, both of programming and abstractions. Writing them down (defining and actually implementing) is the best exercise.
“Standard” type-classes of Haskell (Functor, Monad, etc.) are the same notions on a different syntax and non-OO paradigm.