Hi!
GHC doesn't spot link-time conflicts between explicitly
given .o files and modules contained in packages. For
example, if we compile the module
module Main (main)
where
import Pretty
main :: IO ()
main = putStr (render (nest 2 (text "text")))
with `ghc -c -package text Main.hs' and
module Pretty (Doc)
where
data Doc = Nest Int
with `ghc -c Pretty.hs', then on linking with
ghc -package text Main.o Pretty.o
we get an executable that dumps core (as the Pretty module in
`-package text' also defines a data type `Doc').
I guess, it is difficult to get the linker to complain in
such a situation, but couldn't we maybe add information
about the included modules to the package specification?
Then, the driver could check the list of supplied files
against the modules contained in all used packages. This
information could also be used to check for clashes
inbetween packages (something that can easily happen when
we have SimonM's dynamic package addition capability).
I realise that this is a bit doggy, because the driver
seeing
ghc -package text Main.o Pretty.o
cannot know whether Pretty.o is an object file produced by
GHC or maybe a C object file - but then, it might actually
look for this `hsc.Pretty.hs...' symbol in Pretty.o to find
that out.
Cheers,
Manuel