# nhc98 interface file format (.hi)

The interface file (.hi) format for nhc98 is documented on this page. Interface files are generated automatically by the compiler. If you modify a .hi file, it will likely be overwritten by the compiler the next time you build your module.

However, there are times when it is useful to be able to write (or modify) a .hi file by hand. One occasion is when you have circular dependencies between modules. The cycle can be broken by providing a minimal hand-written interface for one of the modules, then starting to compile the other modules that depend on it. You finish the cycle by compiling the module for which you wrote the interface.

Another occasion is when you need to subvert the type system. For instance, the `unsafeCoerce` function is coded in nhc98 as

        unsafeCoerce = id

but the signature in the .hi file is altered from

        unsafeCoerce :: a -> a

to

        unsafeCoerce :: a -> b

In order to prevent the hand-written .hi file from being overwritten by the compiler, it is necessary to store it in a different directory from the source module. To ensure that the compiler can still find it, that directory must then be passed on the commandline with the `-P` option.

The latest updates to these pages are available on the WWW from `http://www.haskell.org/nhc98/`

This page last modified: 4th January 2008
York Functional Programming Group