Type class

[6] For example, in the GHC standard library, the class IArray expresses a general immutable array interface.

The popular Haskell implementations, GHC and Hugs, support multi-parameter type classes.

Simon Peyton Jones has objected to the introduction of functional dependencies in Haskell on grounds of complexity.

(This is in fact how type classes are implemented under the hood by the Glasgow Haskell Compiler.)

However, coherence adds another level of safety to a language, providing a guarantee that two disjoint parts of the same code will share the same instance.

Instances (or "dictionaries") in Scala type classes are just ordinary values in the language, rather than a completely separate kind of entity.

[12][13] While these instances are by default supplied by finding appropriate instances in scope to be used as the implicit parameters for explicitly-declared implicit formal parameters, that they are ordinary values means that they can be supplied explicitly, to resolve ambiguity.

As a result, Scala type classes do not satisfy the coherence property and are effectively a syntactic sugar for implicit parameters.

This is an example taken from the Cats documentation:[14] Coq (version 8.2 onward) also supports type classes by inferring the appropriate instances.

[15] Recent versions of Agda 2 also provide a similar feature, called "instance arguments".

An analogous notion for overloaded data (implemented in GHC) is that of type family.

Rust supports traits, which are a limited form of type classes with coherence.

The proof assistant Coq has also supported type classes in recent versions.