Polymorphism enables a single operations on many types. It can happen either at compile-time or at runtime.
Kinds of Polymorphism
There are various kind of polymorphism. For example:
- ad-hoc polymorphism (overloading, typeclasses, Rust Traits)
- parametric polymorphism (i.e. generic functions)
- subtyping polymorphism (OCaml objects)
- inheritance
- row polymorphism (OCaml objects and polymorphic variants, Elm records)