In Scala, I would like to ensure that a lambda is associative.
For example, I imagine adding an annotation or extending a trait, then concrete implementation would be tested using reflexion.
But I would like to have the opinion of people more experienced in functional programming. Maybe there is an existing way to do that, or maybe this is something that can be ensured by construction. I just want an automatic way to ensure or check that at compilation to avoid any possible error for fold and reduce.