when is compilation necessary

Simon Peyton-Jones IMCEAEX-_O=MICROSOFT_OU=NORTHAMERICA_CN=RECIPIENTS_CN=428592@microsoft.com
Thu, 20 Jun 2002 09:12:26 +0100


I assume you mean 'bar' in module Main?

| Now, suppose I change Foo.hs so that "foo x =3D x + 2".  If I=20
| ghc --make on=20
| Main, it will build Foo, then Bar, then Main, then link.  Is=20
| all of this necessary or can I (manually) just rebuild Foo=20
| 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=20
that nothing had changed.

	cam-02-unx:~/tmp$ ghc --make Main
	ghc-5.02.3: chasing modules from: Main
	Compiling A                ( A.hs, A.o )
	Skipping  B                ( B.hs, B.o )
	Skipping  Main             ( Main.hs, ./Main.o )
	ghc: linking ...

Simon

| suppose i have three modules:
|=20
| > module Foo(foo) where
| > foo x =3D x + 1
|=20
| > module Bar(bar) where
| > import Foo
| > bar x =3D foo (x+1)
|=20
| > module Main(main) where
| > import Bar
| > main =3D print (foo 5)
|=20
| Now, suppose I change Foo.hs so that "foo x =3D x + 2".  If I=20
| ghc --make on=20
| Main, it will build Foo, then Bar, then Main, then link.  Is=20
| all of this necessary or can I (manually) just rebuild Foo=20
| and then relink?
|=20
| --
| Hal Daume III
|=20
|  "Computer science is no more about computers    | hdaume@isi.edu
|   than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume
|=20
| _______________________________________________
| Glasgow-haskell-users mailing list=20
| Glasgow-haskell-users@haskell.org=20
| http://www.haskell.org/mailman/listinfo/glasgow-| haskell-users
|=20