[Haskell-cafe] Haskell interface files: Why used? What about same data in object files?

Malcolm Wallace malcolm.wallace at cs.york.ac.uk
Tue Aug 4 07:43:46 EDT 2009


> I am trying to understand the design of the Haskell interface files.  
> Why
> are they a separate file rather than having the same data in the  
> object
> file generated by the compiler? (Naively, it seems to me this would  
> work
> also. Am I missing something?)

Placing interface information into object files would be a perfectly  
reasonable design decision for a compiler.  The language standard  
itself does not mandate the use of interface files (although it did  
once, around Haskell 1.2), nor any particular format, so a compiler is  
free to use whatever strategy it wishes.

Some good reasons for having a separate interface are:  they can be  
human-readable and human-writable (ghc's do not fulfill this  
criterion); they can be used to bootstrap mutually recursive modules  
in the absence of any object files (ghc uses .hs-boot files instead);  
other tools can extract information about modules without having to  
understand either the full Haskell syntax or the object language.

Regards,
     Malcolm



More information about the Haskell-Cafe mailing list