Module output directories for extensible interfaces
Motivation
Various tickets suggest that we write extra data alongside traditional interface data:
#17843 proposes an early typechecking (.hi-tc
) variant of .hi
files being written instead of multiple versions of .hi
.
https://gitlab.haskell.org/ghc/ghc/wikis/Core-interface-section proposes extending interface files with optional core data for use by plugins and the like.
Proposal
Replace .hi
files with module output data directories (e.g. .hm
), and use multiple files within these to represent component of output. With this in mind, an example module directory might look like:
Example.hm:
|- symbol-table
|- dictionary
|- ghc:
|- core
|- interface
|- hie
Advantages:
- External tools can treat the
.hm
directory as relatively opaque for the purpose of moving around outputs, etc. without knowing about any additional data. - Outputs can be written at any phase of the compilation process, making this a potential method for storing resumable compilation data.
- Subdirectories allow a natural namespacing structure for external tools operating on modules.
Design options:
- In current the
.hi
format, theName
symbol table andFastString
dictionary is written at the end of the file. Since it's likely that these extra files will overlap in their symbol tables/dictionaries, it might be useful to share a single one of each within the module output directory. - Additional lookup tables for more types than
Name
andFastString
.