-
Notifications
You must be signed in to change notification settings - Fork 40
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
Consider combining executables (and specify backend with switch) #71
Comments
I'm relatively new to haskell, but could give this a go if you'd have some time to point me in the right direction. |
The basic strategy I would follow would be to first find the source files that can be shared between the two without any changes (I think there still are some). Then I would see if any could be modified to be shared, breaking out backend-specific parts (probably a good exercise anyway, as some refactoring is due). Next would be simply renaming and moving the unique modules. The final part would be tackling the driver part (main app), and getting that combined in a clean way. The full effort should be doable even by someone not very experienced with Haskell or this codebase, but I wouldn't advertise it as a fun exercise. The other thing is spago support. I think some changes would be needed there to make sure everything works with it correctly. |
Another option is one combined codebase but still have separate executables for each (pscpp, psgo). That would at least have no impact on spago, and might be the cleanest approach. It could also be a good first step even if eventually there was one combined executable. |
I would think the two executables sounds better, since it maintains the "interface" of the separate executables. I prefer to change one thing at a time. I'll check out the two branches and see if I'm up to the challenge. |
I have a branch where I merged everything and left the cpp issues commented out for now, so I could see the scope of the changes https://github.com/andyarvanitis/purescript-native/compare/golang...joprice:combine?expand=1. Here are my thoughts so far:
I didn't go through with any of this yet since it all hinges on the backend enum. Another approach is to include separate sources in each executable, so they can have entirely separate code paths. If the code diverged or will diverge in the future a huge amount, I would say that's a better path. Currently it's very similar and easy enough to just pattern match on backend. Also, having them in a single binary might supports taking a flag to switch backends instead of having two binaries (for instance, if spago could pass default flags to a binary or if the binary is installed on someone's box wrapped in a bash runner script that adds the flag). |
No description provided.
The text was updated successfully, but these errors were encountered: