From a73c835abe259df8087248cfe8748d83d966a88e Mon Sep 17 00:00:00 2001 From: simonpj Date: Fri, 1 Oct 2004 16:03:58 +0000 Subject: [PATCH] [project @ 2004-10-01 16:03:58 by simonpj] A bit more about hi-boot --- ghc/docs/users_guide/separate_compilation.xml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/ghc/docs/users_guide/separate_compilation.xml b/ghc/docs/users_guide/separate_compilation.xml index 7606e1a..7fe1a1a 100644 --- a/ghc/docs/users_guide/separate_compilation.xml +++ b/ghc/docs/users_guide/separate_compilation.xml @@ -942,12 +942,19 @@ module A where newtype TA = MkTA GHC.Base.Int + 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 syntax is similar to a normal Haskell source file, but with some important differences: - Non-local entities must be qualified with their + Local entities (ones defined in the same hi-boot file may + be mentioned unqualified, but non-local entities (ones defined in other modules) + must be qualified with their original defining module. Qualifying by a module which just re-exports the entity won't do. In particular, most Prelude entities aren't @@ -1002,10 +1009,14 @@ operations. We could lift this restriction if it became tiresome. - 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. +If M.hi-boot mentions an entity N.f, defined in some other +module N, then GHC will by default go hunting for N.hi. If module +N is not yet compiled either, GHC won't look for N.hi-boot; it'll just +complain. To fix this, in the source file that uses +import {-# SOURCE #-} M, add +import {-# SOURCE #-} N(). (The "()" says that you don't want to import anything into +your current scope, and will prevent unused-import warnings.) You only need this if no other imported module +depends on N.hi-boot. -- 1.7.10.4