Accessing Functions in Other Files

We’re going to be using the shirt size data type and its associated functions from Chapter 3, Creating Your Own Data Types for several of the examples—and it would be nice to not have to duplicate that code to each of the files. Before getting into the discussion of collections, we can do some housekeeping and solve that problem. First, create a project:

 you@computer:~/book_projects> bsb -init collections -theme basic-reason
 Making directory collections
 Symlink bs-platform in /home/you/book_projects/collections
 you@computer:~/book_projects> cd collections

and put all the shirt size handling code into one file. Let’s rename some of the functions to make typing and readability easier, and remove the ...

Get Web Development with ReasonML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.