[GHC] #4453: Allow specifying .hi files of imports on command line in batch mode

GHC cvs-ghc at haskell.org
Fri Oct 29 10:31:29 EDT 2010


#4453: Allow specifying .hi files of imports on command line in batch mode
---------------------------------+------------------------------------------
    Reporter:  duncan            |       Owner:              
        Type:  feature request   |      Status:  new         
    Priority:  normal            |   Component:  Compiler    
     Version:  6.12.3            |    Keywords:              
    Testcase:                    |   Blockedby:              
          Os:  Unknown/Multiple  |    Blocking:              
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown
---------------------------------+------------------------------------------
 It is useful for a build agent (e.g. cabal, or makefile) to have full
 control over the search path. Reasons you might want to do this are below.

 The way a build agent can do this is to instruct ghc not to do any
 searching at all, using the flag `-i` which sets the search path to empty.
 Then the build agent has to supply ghc with all the `.hs` files that are
 needed, e.g.:
 {{{
 ghc --make -i Foo.hs Bar.hs
 }}}
 (any imports outside of these modules, or the package modules will fail)

 This no-search scheme works in `--make` mode but not in batch mode. For
 that we need to be able to say:
 {{{
 ghc -i -c Foo.hs
 ghc -i -c Bar.hs Foo.hi
 }}}
 That is, we need to be able to specify the .hi files of imported modules
 on the command line.

 A build agent may want to do this so that it is insulated from the
 particular choices of ghc's search path semantics and/or have different
 choices. For example, ghc prefers modules in local .hs/.hi files to
 package modules while the build agent may want the reverse in some
 circumstances.

 Apart from search path policy, it makes sense for a build agent to take
 this approach simply for correctness and simplicity. A correct build agent
 must track dependencies absolutely precisely, so it has to know which
 specific .hi files ghc will pick anyway. It is simpler for the build agent
 to tell ghc those .hi files rather than trying to precisely arrange things
 to match ghc's search behaviour.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4453>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list