February 2019
Beginner to intermediate
180 pages
4h 4m
English
As you now know, all .re files are modules and all modules are globally available—including nested ones. By default, all types and bindings can be accessed from anywhere by providing the namespace. However, doing this over and over quickly becomes tedious. Luckily, we have a few ways to make this more pleasant:
/* Foo.re */type fromFoo = | Add(int, int) | Multiply(int, int);let a = 1;let b = 2;
Next, we'll use the Foo module's fromFoo type along with it's bindings within another module in different ways:
/* Bar.re */let fromFoo = Foo.Add(Foo.a, Foo.b);
/* Bar.re */
Read now
Unlock full access