There is currently no budget planned to adapt stack to use GHCi’s multi home unit feature.
However, it would be great to teach stack about multiple home units and will try to answer any question that arises.
Thanks for pointing this out, this name is a mistake and it should be lib-mhu-example
.
The name of the home unit is specified by the tool, e.g. cabal invokes GHC with the argument: -this-unit-id ...
which is used as the name of the home unit. In the diagram, we took the liberty to use the component name, as users are usually more familiar with components than units.
To be precise, the home unit graph would only use what is given in the -this-unit-id
flag. We will not change the format of unit ID
, so lib:mhu-example
is not a valid unit id. It is only used as an attempt to make it more approachable.
Yes, precisely, the flag -package-id <unit-id>
is used to express the dependency.
The blog post is particularly talking about GHCi support, independent of Cabal, cabal-install or stack.
I am not aware of any efforts of updating Setup.hs repl
to use multiple home unit with GHCi.
No, it does not!
Currently, we first parse all cli arguments into DynFlags
, including -unit
arguments. We then use the initial DynFlags
(e.g., the flags given at the top-level) and then process arguments in the -unit
response files.
As an example:
ghc -fwrite-ide-info -unit @a -unit @b
then the option -fwrite-ide-info
is prepended to the arguments given in @a
and @b
.
Perhaps counter-intuitively, the order doesn’t matter.
ghc -unit @a -unit @b -fwrite-ide-info
is the same ghc invocation, the -fwrite-ide-info
option would be prepended to the options @a
and @b
.