Update GHCi users guide documentation
I noticed that when I was looking through the users guide for the 9.4.1
alpha-1 release, the GHCi guide makes use of the fact that GHCi uses
timestamps for recompilation checking by touch
-ing a file in order to
trigger recompilation. Of course, since !5661 (merged), this no longer works -
the compiler compares the MD5 hash of the source file to the hash from the last time it compiled that module, and of
course it is unchanged. I went in to update this to use echo
to append a
comment to the end of the file in order to ensure that a recompilation
is triggered, and in the process I realised that there are a few other
ways that the current behaviour of GHCi differs from what is described
here, so I have updated these too. All of the output lines I've modified
are from a session with GHC 9.4.1-alpha1.
The main difference (aside from the touch
change) is that it appears
that at some point, GHC became more strict about compiling modules to
static vs dynamic object code. It appears that at some point GHC might
have inferred -dynamic
based on the object files that already exist,
so that you were only required to specify -dynamic
in the first
invocation to compile D.hs, whereas now if you try to compile separate
modules with different static/dynamic settings you get an error:
$ ghc -c -dynamic D.hs
$ ghc -c C.hs
C.hs:3:1: error:
Bad interface file: ./D.hi
mismatched interface file profile tag (wanted "", got "dyn")
|
3 | import D
| ^^^^^^^^
So it seemed to me that the most sensible way to update this guide was
to specify -dynamic
in each ghc
invocation.