Can Cabal generate distinct unit-ids for executables?

I’m trying to do some project analysis using HIE files, and currently I’m a bit stuck because Cabal states that all executables have modules in the main unit. This means that in practice I end up with a whole bunch of stuff being a dependency of main:Main, when in reality I have multiple Main modules in distinct units. Is there a way to convince Cabal to use a fresh unit ID for each executable?

1 Like

I found this commit which seems to talk about passing -this-unit-id for executables - is this perhaps what I need?

Woohoo easy solution - just build master! All works perfectly now, thank you @mpickering, assuming the linked commit is the one I needed!

1 Like

Yes, cabal-install will now provide unit-ids for all the components it builds (including executables, testsuites and foreign librarys). Happy hacking!

6 Likes