Mutually-recursive/cyclic module imports

Isaac Dupree isaacdupree at charter.net
Fri Aug 15 14:00:14 EDT 2008


Isaac Dupree wrote:
> In the case of the proposed SOURCE imports without hs-boot files, GHC 
> would ...

Ah, another difference from the .hs-boot system: in my 
proposal, when a file is imported with SOURCE and dependency 
chasing (e.g. of data-types) is done through its imports, it 
won't make a difference whether those imports have SOURCE 
pragmas; the compiler is in SOURCE-mode already, and will 
look at .hi files if there are any up-to-date ones available 
(e.g. the imported module isn't in the SCC / import loop), 
and otherwise will look at the source code (if it wanted, it 
could make some sort of .hi-boot out of it, I suppose).

As opposed to the .hs-boot mechanism where .hs-boot files 
must choose carefully (and perhaps differently to the 
corresponding .hs file) whether their imports use SOURCE 
(they must if it's necessary to prevent loops, but must not 
if that module doesn't have a .hs-boot file that contains 
what's needed! But sometimes it doesn't make a difference, 
except for recompilation!)

-Isaac


More information about the Haskell-prime mailing list