We have seen that ReasonML supports parametric polymorphism using type variables, one of the language features. When using type variable as the type of a function's parameter, values of any type are accepted for that parameter. This technique allows writing what we call generic functions and plays an important part in code reusability in ReasonML.
In contrast, ad hoc polymorphism, the other kind of polymorphism that is supported in popular programming languages, does not yet exist in ReasonML. But work is in progress to correct that lack in a future version.
Modules also play an important role in code reuse. But, that's not all. In addition to what they allow by themselves, ReasonML has a powerful feature that augments what we can do with them: functors. They are like special functions that take one or several modules as input and return a module. That opens...