cabal icon indicating copy to clipboard operation
cabal copied to clipboard

Multiple Home Units support

Open chshersh opened this issue 3 years ago • 5 comments

Currently (with cabal-install 3.6), when running cabal repl with multiple components, users see the following error message:

$ cabal repl comp1 comp2
cabal: Cannot open a repl for multiple components at once. The targets
'comp1' and 'comp2' refer to different components..

The reason for this limitation is that current versions of ghci do not support
loading multiple components as source. Load just one component and when you
make changes to a dependent component then quit and reload.

The ability to load REPL with multiple components is commonly known as "Multiple Home Units (MHU)". The following blog post by Matthew Pickering (Well-Typed) from January 7, 2022, claims that this feature is implemented in GHC and now it's up to build tools to support it:

  • https://well-typed.com/blog/2022/01/multiple-home-units/

I haven't found an issue in Cabal tracking the implementation of Multiple Home Units. There's a similar issue but it seems to be talking about something else:

  • https://github.com/haskell/cabal/issues/3659

chshersh avatar Jun 21 '22 15:06 chshersh

Yes, I think you are right this is not being added yet and we do need it. PR welcome (perhaps many small PRs, baby step style)

Mikolaj avatar Jun 22 '22 08:06 Mikolaj

I think we could just have a single point of support for now that turns a repl call with multiple targets into an invocation of ghci with multiple home units. However, that won't be super useful yet, given ghci's apparently limited support of multiple home units still. https://gitlab.haskell.org/ghc/ghc/-/issues/20889

gbaz avatar Jul 23 '22 21:07 gbaz

Apparently @wz1000 is working on this?

phadej avatar Jul 24 '22 19:07 phadej

Yes, I'm working on this. I'll have a patch up shortly.

wz1000 avatar Jul 26 '22 08:07 wz1000

@wz1000 just a gentle inquiry: do you have any news on that patch you mentioned?

ulysses4ever avatar Sep 16 '22 14:09 ulysses4ever

Did #8726 fix this?

ocharles avatar Nov 27 '23 09:11 ocharles

Yes #8726 fixed this.

mpickering avatar Nov 27 '23 17:11 mpickering