Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0058608
Reorder a paragraph in functors tutorial to improve content flow
neuroevolutus Feb 3, 2024
b9c95a5
Grammar: add the word "by" in functors tutorial
neuroevolutus Feb 3, 2024
e3ee4cd
Clarify note on `with type` constraint in functors tutorial
neuroevolutus Feb 3, 2024
9a8498a
Simplify note on `with type` constraint in functors tutorial
neuroevolutus Feb 5, 2024
2a3ea11
Grammar: add the word "of" in functors tutorial
neuroevolutus Feb 5, 2024
03758f0
Add section on empty variants in basic data types tutorial
neuroevolutus Feb 5, 2024
722bd1b
Add missing definition to `Binary` functor in functors tutorial
neuroevolutus Feb 5, 2024
57f5191
Grammar: use "facilitate" over "allows" in functors tutorial
neuroevolutus Feb 6, 2024
f558f95
Add section on naming and scoping to functors tutorial
neuroevolutus Feb 6, 2024
cd87f3e
Reword section header in functors tutorial
neuroevolutus Feb 6, 2024
b443443
Use more self-explanatory constructor in functors tutorial
neuroevolutus Feb 6, 2024
7438292
Improve compiler error explanation in functors tutorial
neuroevolutus Feb 6, 2024
c6eeb26
Remove unnecessary word in functors tutorial
neuroevolutus Feb 6, 2024
5401b2d
Remove small digression from functors tutorial
neuroevolutus Feb 6, 2024
b0e29ab
Simplify sentence in functors tutorial
neuroevolutus Feb 6, 2024
22f000d
Reword explanation on scoping in functors tutorial
neuroevolutus Feb 6, 2024
1deafff
Remove extra space and add comma after "i.e." in functors tutorial
neuroevolutus Feb 6, 2024
4023527
Revert "Add section on empty variants in basic data types tutorial"
neuroevolutus Feb 6, 2024
6afcdcd
Remove empty variants as placeholders in `Binary` functor example
neuroevolutus Feb 6, 2024
98a2383
Apply suggestions from code review
cuihtlauac Feb 9, 2024
ac98365
Apply suggestions from code review
cuihtlauac Feb 9, 2024
fb1188d
Update data/tutorials/language/1ms_01_functors.md
cuihtlauac Feb 9, 2024
2fcf239
Clarify note on `with type` constraint in functors tutorial
neuroevolutus Feb 9, 2024
3a8394e
Typo: change "In" to "If" in functors tutorial
neuroevolutus Feb 9, 2024
999bb22
Apply suggestions from code review
cuihtlauac Feb 12, 2024
c1a6c07
Update data/tutorials/language/1ms_01_functors.md
cuihtlauac Feb 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/tutorials/language/1ms_01_functors.md
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ let _ =

Check the program's behaviour using `opam exec -- dune exec funkt < dune`.

**Note**: The functor `IterPrint.Make` exposes the type from the injected dependency (here first `List.t` then `Array.t`) as the type `t` required of the result module. That's why a `with type` constraint is needed. When customising a type that's not exposed by the result module (i.e. an _implementation detail_), the `with type` constraint is not needed. As a further consequence of this, we could even define a local type `t` within the `struct` block for use within the implementation, and such a type `t` would not shadow the type `t` of the result module.
**Note**: Modules received and returned by `IterPrint.Make` both have a type `t`. The `with type ... :=` constraint is needed to make the two `t` identical. This allows functions from the injected dependency and result module to use the same type. When the parameter's contained type is not exposed by the result module (i.e. when it is an _implementation detail_), the `with type` constraint is unnecessary.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**Note**: Modules received and returned by `IterPrint.Make` both have a type `t`. The `with type ... :=` constraint is needed to make the two `t` identical. This allows functions from the injected dependency and result module to use the same type. When the parameter's contained type is not exposed by the result module (i.e. when it is an _implementation detail_), the `with type` constraint is unnecessary.
**Note**: Modules received and returned by `IterPrint.Make` both have a type `t`. The `with type ... :=` constraint is needed to make the two `t` modules identical. This allows functions from the injected dependency and result module to use the same type. When the parameter's contained type is not exposed by the result module (i.e., when it is an _implementation detail_), the `with type` constraint is unnecessary.

It reads funny to me to have a plural (two) with just t -- is it accurate to have t modules instead? ...or t types?

Regardless, there needs to be a comma after i.e.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching that. I made sure to add the comma in that part.

With regards to the t, I think it may be fine to keep it as is since the t refers to two types rather than modules per se. What are your thoughts, @cuihtlauac?


## Write a Functor to Extend Modules

Expand Down