Main-by-hash
- Dominant language
- Haskell
- Stars
- 1.3k
- Forks
- 201
- PR merge metrics
- No merged PRs in 30d
Description
Per discussion with @alphalambda
In the spirit of import-by-hash (#1195) and prelude-by-hash (#1245), it would be interesting to define main-by-hash. In this mode, the compiler would pass a `--main-is` option to GHC that points to something else besides the student code (which is in module `Main`). That something else could import `Main`, but define its own entry point that calls the student code.
There's one problem: if student code lacks a module header (as it usually does), then GHC interprets this to mean only export the `main` (or `program` in codeworld mode) symbol. So naively, student code would need to have a module header, and that's a heavy enough impediment to sink the feature.
Option 1: Convince GHC to add an option to change the interpretation of missing module headers. It would be an easy change, but maybe not easy to convince GHC developers of the importance.
Option 2: Rewrite student code to have an explicit module header. Rewriting student code has never been done before, though, because it makes it hard to match error messages in the compiled code to the correct location in the input.
For now, this is a low priority.
Contributor guide
Assessment
This issue has not been assessed yet.