-
Notifications
You must be signed in to change notification settings - Fork 86
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
Separate modules in code generation #279
Comments
Somewhat related to this issue, it would be nice if the generated code uses the JavaScript module pattern. Made up example:
Would generate this javascript:
This way, one can call
|
I'm almost done with this now, it's on the
Internally Fay still uses qualified names for everything which makes the output a lot smaller. |
JavasScript is very dynamic, so it can handle using the same name for two different things :-) You can extend existing objects if they already exist. For example:
Although I just realised that won't work if file |
Yeah, I keep track of which module paths have been added already, so I just need to add constructors to that list.
|
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/length There might be more Haskell names that conflict with JavaScript reserved words and such. I think in those cases you need to add something like a |
Yes I'm aware :) And yeah I'll probably |
This was released in |
compileTopLevelModule
should be less special, instead each module can generate all the code it needs and compileTopLevelModule can be responsible for the overall structure.The generated modules can then look more like Haskell modules:
The text was updated successfully, but these errors were encountered: