-
Notifications
You must be signed in to change notification settings - Fork 358
Update Modules and Functors Tutorials #1778
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
Conversation
8000219
to
b2f1576
Compare
b2f1576
to
3aed397
Compare
|
||
A functor is a module that is parametrised by another module, just like a | ||
function is a value which is parametrised by other values, the arguments. | ||
A functor is just a parametrized module. |
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 think the older description was better here since it describes a functor by analogy with something else that people may be familiar with.
I'd take it a little further and say that functors are functions but that instead of regular values they take modules as inputs and create modules as outputs.
This intuition I think can help with other things, like the "transitive closures leading to modules" prerequisite.
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.
Sorry, I should have said that what I've written here is interim text. The original intro had some good ideas but it needs to be rewritten. This also applies to the transitive closure thing, of course we're not going to publish this as is.
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.
No worries, and nothing to be sorry for! 🙏🏼
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.
Should we also say something like this?
The term functor comes from a branch of mathematics called category theory. Although OCaml functors are loosely inspired by them, no knowledge of that math is required to understand and work with OCaml functors. Functors in Haskell more closely represent the Category Theory concept and are, have nothing in common with OCaml functors.
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.
Some initial comments/suggestions/questions
Haven't double checked the code yet.
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.
Initial comments/suggestions/questions for functors.md
Co-authored-by: Christine Rose <[email protected]>
7814c46
to
54352d0
Compare
Reorganise, update and complete tutorials on Modules and Functors. The draft outline follows. Top-level items are stand-alone tutorials.
Open questions:
Set
andMap
tutorialsP.S. As of creating this PR, it doesn't patch anything. Only discussion