when is compilation necessary

Hal Daume III hdaume@ISI.EDU
Thu, 20 Jun 2002 10:21:24 -0700 (PDT)


On Thu, 20 Jun 2002, Simon Peyton-Jones wrote:

> I assume you mean 'bar' in module Main?

Yes :)

> | Now, suppose I change Foo.hs so that "foo x = x + 2".  If I 
> | ghc --make on 
> | Main, it will build Foo, then Bar, then Main, then link.  Is 
> | all of this necessary or can I (manually) just rebuild Foo 
> | and then relink?
> 
> Necessary with -O (because the defn of foo may be inlined in Bar).
> Not necessary without -O.  GHC takes a look at Bar, in case foo's type
> has changed, but the "skipping" message says that it decided 
> that nothing had changed.

So...suppose I compile with -O and it inlines foo into Bar.  I then change
foo to be "foo x = x + 2" and recompile --make Main without -O.  Is there
a possibility that result won't have the correct version of foo?

 - Hal