ReasonML has fantastic support for the software engineering practice of dividing programs into small, modular components that can be swapped out for each other.
In this chapter, we will cover:
- Modules and how they can be used to package types and values together
- The difference between file modules and syntactic modules
- Module signatures (both file and syntactic)
- Using signatures to achieve information hiding
- Using signatures to achieve type abstraction
- Achieving zero-cost abstraction
Modules are groups of types and values accessible under a single name. This can be incredibly useful when you want to associate some types and operations together to make them easier to find and use together. They are kind of like namespaces in other languages, but more powerful because they can be composed in various ways.
Let's look at how to make some...