-
Notifications
You must be signed in to change notification settings - Fork 369
Improve some wording in the functors tutorial #2023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 17 commits
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 b9c95a5
Grammar: add the word "by" in functors tutorial
neuroevolutus e3ee4cd
Clarify note on `with type` constraint in functors tutorial
neuroevolutus 9a8498a
Simplify note on `with type` constraint in functors tutorial
neuroevolutus 2a3ea11
Grammar: add the word "of" in functors tutorial
neuroevolutus 03758f0
Add section on empty variants in basic data types tutorial
neuroevolutus 722bd1b
Add missing definition to `Binary` functor in functors tutorial
neuroevolutus 57f5191
Grammar: use "facilitate" over "allows" in functors tutorial
neuroevolutus f558f95
Add section on naming and scoping to functors tutorial
neuroevolutus cd87f3e
Reword section header in functors tutorial
neuroevolutus b443443
Use more self-explanatory constructor in functors tutorial
neuroevolutus 7438292
Improve compiler error explanation in functors tutorial
neuroevolutus c6eeb26
Remove unnecessary word in functors tutorial
neuroevolutus 5401b2d
Remove small digression from functors tutorial
neuroevolutus b0e29ab
Simplify sentence in functors tutorial
neuroevolutus 22f000d
Reword explanation on scoping in functors tutorial
neuroevolutus 1deafff
Remove extra space and add comma after "i.e." in functors tutorial
neuroevolutus 4023527
Revert "Add section on empty variants in basic data types tutorial"
neuroevolutus 6afcdcd
Remove empty variants as placeholders in `Binary` functor example
neuroevolutus 98a2383
Apply suggestions from code review
cuihtlauac ac98365
Apply suggestions from code review
cuihtlauac fb1188d
Update data/tutorials/language/1ms_01_functors.md
cuihtlauac 2fcf239
Clarify note on `with type` constraint in functors tutorial
neuroevolutus 3a8394e
Typo: change "In" to "If" in functors tutorial
neuroevolutus 999bb22
Apply suggestions from code review
cuihtlauac c1a6c07
Update data/tutorials/language/1ms_01_functors.md
cuihtlauac File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the intended use case for empty types (see https://ocaml.org/manual/emptyvariants.html for an explanation of why they were introduced). An abstract type works better as a placeholder for the use case you are describing. I would thus avoid mentioning empty variant types before the GADT introduction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. That would make sense. I'll revert the corresponding commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've edited the
Binaryfunctor example to makeeltandtabstract types.Thanks for the link to the manual! I'll check that out.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To give a better example of what I meant by "abstract type are better placeholder", if you write
the function
fis total: the only list of empty values is the empty list. But this is property is only true for empty types. In other words, by using empty types as placeholders one might accidentally capture properties that are only true for empty types.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. I think I better understand now. As an aside, are there any examples in the wild where using empty types and refutation cases for them come in handy when it comes to GADTs? I think I'm still fuzzy on the motivation for empty types.