Replies: 4 comments 11 replies
-
|
A couple added notes:
|
Beta Was this translation helpful? Give feedback.
-
|
Another idea I had post-lunch was to combine the concept of modules/blocks by allowing for modules to "return" expressions. We had discussed having an optional expression in the last position in a module so that could be the default viewed value in a buffer. If we had this be the full evaluated value you get something that may supplant blocks/let expressions. In the following examples This would be behaviorally the same as If there was no final expression it would instead be a module binding: Pros
Cons
|
Beta Was this translation helpful? Give feedback.
-
|
I don't want to just keep throwing out random ideas, but I was thinking about the type punning this past weekend where: Would implicitly do and I was wondering if there's a more general way to accomplish this goal. One issue with the above is you have to keep your local aliases in line with the internal type declaration for it to work and I'm not sure what this would look like in the hazel world tree approach: If we have a bunch of top-level modules are they implicitly available in all other modules to make their types available or do I have to write something akin to the following to get the type to show up Self-typed moduleI'm wondering instead of opening a type alias based on having the same name if it were possible to have modules contain an optional self/representative type that would allow them to be used as a type: This seems really useful for the cases where you're defining modules for a specific type with a bunch of helper functions which seems quite often as it allows you to alias the module and type together. I'm not done reading Modular Type Classes but it seems like they also require the |
Beta Was this translation helpful? Give feedback.
-
|
Not sure I see the problem with having the type share the name of the module. The type alias would be in the same scope as the module so presumably it would be available everywhere the module is available. I think it's more readable to look at signatures of values inside a module if the type name is used rather than Self. |
Beta Was this translation helpful? Give feedback.



Uh oh!
There was an error while loading. Please reload this page.
-
This is in reference to discussions had by Alexander @7h3kk1d, Andrew @disconcision, Matt @Negabinary, and Myself @gcrois on 10 March, 2025.
Whiteboard:
We need a module system in Hazel -- primarily for three applications:
There has already been significant development work towards this, visible in this PR: #1020. Unfortunately, there have been substantial changes to the Hazel codebase, so much of these changes should be reworked. We also wanted to take this opportunity to ensure that we are in agreement on the semantics and syntax of modules.
Considerations:
letformodule... in...vs. (b)module... end / module { ... }let... in...in module definition body (closure capture) vs. (b)... = .../... := ...(record-like but mutually recursive)Here are some examples of how we might use modules:
Livelit definition
We would like to further discuss this, including development strategies, at lunch on Wed, 12 March 2025.
Beta Was this translation helpful? Give feedback.
All reactions