Let's look at another way of creating modules in Reason: syntactic modules. These are modules that are defined using Reason's module syntax. Here's an example:
/* src/Ch03/Ch03_Domain.re */
module Person = {
type t = {id: int, name: string};
let make(id, name) = {id, name};
};
module Company = {
type t = {id: int, name: string, employees: list(Person.t)};
};
Here we define a Domain file module to contain two nested modules: Person and Company. These nested modules actually contain types similar to the ones we defined in src/Ch02/Ch02_Demo.re, but this time with both types named t.
Let's digress a little into the type name t. This is a standard naming convention in the Reason ecosystem to mean the main type in the module. Usually, you refer to a module along with its main type, for example, Person.t or Company.t, so it's quite clear exactly...