
There does not seem to be a way to feed GHC a list of object files to
#9562: Type families + hs-boot files = unsafeCoerce -------------------------------------+------------------------------------- Reporter: goldfire | Owner: ezyang Type: bug | Status: new Priority: high | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC accepts | Unknown/Multiple invalid program | Test Case: Blocked By: | Blocking: Related Tickets: #10270 | Differential Revisions: -------------------------------------+------------------------------------- Comment (by ezyang): link together and coax it to skip linking Actually, this is not true: {{{ ezyang@sabre:~$ ghc -c A.hs ezyang@sabre:~$ ghc -c B.hs-boot ezyang@sabre:~$ ghc -c C.hs ezyang@sabre:~$ ghc -c B.hs ezyang@sabre:~$ ghc -c D.hs ezyang@sabre:~$ ghc -c Main.hs ezyang@sabre:~$ ghc Main.o A.o B.o C.o D.o -o Unsafe ezyang@sabre:~$ ./Unsafe -5692549928996289131 }}} Unfortunately, GHC has no idea about the dependency structure of the object files; for all it knows, it could have been produced by another compiler. So there actually is no way for GHC to figure out that `B.o` is type-unsafe in this case. This would imply the only way to safely link Haskell objects is to use `ghc Main.hs` (which will do dependency resolution.) Note that Richard's original proposed fix will work in this case, since `B.hs` will be refused as `B.hs-boot` doesn't report enough type families. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9562#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler