Skip to content

Commit 7c58c08

Browse files
committed
docs: replace usage of functor with module functions
1 parent df3aaec commit 7c58c08

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

pages/docs/manual/latest/module.mdx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -413,22 +413,22 @@ type state = int
413413
let render: string => string
414414
```
415415

416-
## Module Functions (functors)
416+
## Module Functions
417417

418418
Modules can be passed to functions! It would be the equivalent of passing a file
419419
as a first-class item. However, modules are at a different "layer" of the
420420
language than other common concepts, so we can't pass them to *regular*
421-
functions. Instead, we pass them to special functions called "functors".
421+
functions. Instead, we pass them to special functions called module functions.
422422

423-
The syntax for defining and using functors is very much like the syntax
423+
The syntax for defining and using module functions is very much like the syntax
424424
for defining and using regular functions. The primary differences are:
425425

426-
- Functors use the `module` keyword instead of `let`.
427-
- Functors take modules as arguments and return a module.
428-
- Functors *require* annotating arguments.
429-
- Functors must start with a capital letter (just like modules/signatures).
426+
- Module functions use the `module` keyword instead of `let`.
427+
- Module functions take modules as arguments and return a module.
428+
- Module functions *require* annotating arguments.
429+
- Module functions must start with a capital letter (just like modules/signatures).
430430

431-
Here's an example `MakeSet` functor, that takes in a module of the type
431+
Here's an example `MakeSet` module function, that takes in a module of the type
432432
`Comparable` and returns a new set that can contain such comparable items.
433433

434434
<CodeTab labels={["ReScript", "JS Output"]}>
@@ -482,7 +482,7 @@ function MakeSet(Item) {
482482

483483
</CodeTab>
484484

485-
Functors can be applied using function application syntax. In this case, we're
485+
Module functions can be applied using function application syntax. In this case, we're
486486
creating a set, whose items are pairs of integers.
487487

488488
<CodeTab labels={["ReScript", "JS Output"]}>
@@ -525,12 +525,12 @@ var SetOfIntPairs = {
525525

526526
### Module functions types
527527

528-
Like with module types, functor types also act to constrain and hide what we may
529-
assume about functors. The syntax for functor types are consistent with those
528+
Like with module types, module function types also act to constrain and hide what we may
529+
assume about module functions. The syntax for module function types are consistent with those
530530
for function types, but with types capitalized to represent the signatures of
531-
modules the functor accepts as arguments and return values. In the
531+
modules the module functions accepts as arguments and return values. In the
532532
previous example, we're exposing the backing type of a set; by giving `MakeSet`
533-
a functor signature, we can hide the underlying data structure!
533+
a module function signature, we can hide the underlying data structure!
534534

535535
<CodeTab labels={["ReScript", "JS Output"]}>
536536

@@ -566,4 +566,4 @@ Please note that modules with an exotic filename will not be accessible from oth
566566

567567
## Tips & Tricks
568568

569-
Modules and functors are at a different "layer" of language than the rest (functions, let bindings, data structures, etc.). For example, you can't easily pass them into a tuple or record. Use them judiciously, if ever! Lots of times, just a record or a function is enough.
569+
Modules and module functions are at a different "layer" of language than the rest (functions, let bindings, data structures, etc.). For example, you can't easily pass them into a tuple or record. Use them judiciously, if ever! Lots of times, just a record or a function is enough.

0 commit comments

Comments
 (0)