February 2019
Beginner to intermediate
180 pages
4h 4m
English
The make function is used to create a populated list. It accepts an integer for the length of the list and a value for each item in the list. Its type is as follows:
(int, 'a) => Belt.List.t('a)
Belt.List.t is exposed as an alias of the list type, so we can say the type of Belt.List.make is as follows:
(int, 'a) => list('a)
We can use it to create a list containing ten strings, like so:
let list = Belt.List.make(10, "string");
In Chapter 5, Effective ML, we will learn about how to explicitly expose or hide types and bindings from a module.
Read now
Unlock full access