import B
-newtype A = A Int
+newtype TA = MkTA Int
-f :: B -> A
-f (B x) = A x
+f :: TB -> TA
+f (MkTB x) = MkTA x
--------
module B where
import A
-data B = B !Int
+data TB = MkTB !Int
-g :: A -> B
-g (A x) = B x
+g :: TA -> TB
+g (MkTA x) = MkTB x
</verb></tscreen>
When compiling either module A and B, the compiler will try (in vain)
the following:
<tscreen><verb>
-__interface A 1 where
-__exports A A f;
-__import PrelBase Int;
-1 newtype A = A PrelBase.Int ;
-1 f :: A -> A ;
+__interface A 1 404 where
+__export A TA{MkTA} ;
+1 newtype TA = MkTA PrelBase.Int ;
</verb></tscreen>
The syntax is essentially the same as a normal @.hi@ file
(unfortunately), but you can usually tailor an existing @.hi@ file to
make a @.hi-boot@ file.
-Notice that we only put the declaration for the newtype @A@ in the
+Notice that we only put the declaration for the newtype @TA@ in the
@hi-boot@ file, not the signature for @f@, since @f@ isn't used by
@B@.
+The number ``1'' after ``__interface A'' gives the version number of module A;
+it is incremented whenever anything in A's interface file changes. The ``404'' is
+the version number of the interface file <em>syntax</em>; we change it when
+we change the syntax of interface files so that you get a better error message when
+you try to read an old-format file with a new-format compiler.
+
The number ``1'' at the beginning of a declaration is the <em>version
number</em> of that declaration: for the purposes of @.hi-boot@ files
these can all be set to 1. All names must be fully qualified with the
which is a module internal to GHC's prelude. It's a pain, but that's
the way it is.
+If you want an hi-boot file to export a data type, but you don't want to give its constructors
+(because the constructors aren't used by the SOURCE-importing module), you can write simply:
+
+<tscreen><verb>
+__interface A 1 404 where
+__export A TA;
+1 data TA
+</verb></tscreen>
+
+(You must write all the type parameters, but leave out the '=' and everything that follows it.)
+
<bf>Note:</bf> This is all a temporary solution, a version of the
compiler that handles mutually recursive properly without the manual
-construction of interface files, is in the works.
+construction of interface files, is (allegedly) in the works.
%************************************************************************
%* *
<nidx>-Onot option</nidx>
<nidx>optimising, reset</nidx>
-This option will make GHC ``forget'' any -Oish options it has seen so
+This option will make GHC ``forget'' any @-O@ish options it has seen so
far. Sometimes useful; for example: @make all EXTRA_HC_OPTS=-Onot@.
<tag>@-Ofile <file>@:</tag>
something. When we want to go for broke, we tend to use @-O -fvia-C
-O2-for-C@ (and we go for lots of coffee breaks).
-The easiest way to see what @-O@ (etc) ``really mean'' is to run with
+The easiest way to see what @-O@ (etc.) ``really mean'' is to run with
@-v@, then stand back in amazement. Alternatively, just look at the
@HsC_minus<blah>@ lists in the @ghc@ driver script.
for a parallel machine and the others weren't.) You may turn off this
check with @-no-link-chk@. You can turn it (back) on with
@-link-chk@ (the default).
+
+<tag><tt>-no-hs-main</tt>:</tag>
+<nidx>-no-hs-main option</nidx>
+<nidx>linking Haskell libraries with foreign code</nidx>
+
+In the event you want to include ghc-compiled code as part of another
+(non-Haskell) program, the RTS will not be supplying its definition of
+<tt/main()/ at link-time, you will have to. To signal that to the
+driver script when linking, use <tt/-no-hs-main/.
+
+Notice that since the command-line passed to the linker is rather
+involved, you probably want to use the ghc driver script to do the
+final link of your `mixed-language' application. This is not a
+requirement though, just try linking once with <tt/-v/ on to see what
+options the driver passes through to the linker.
+
</descrip>
%************************************************************************