When compiling an ``import'' declaration the compiler needs to consult the interface file for the imported module. To find the interface file the compiler looks for the module name extended with ``.hi'' in the include path. The include path is a colon separated list of directories that are searched in order for the imported files. The include path can be set in several ways. The default value is ``.:$HBCDIR/hbc_library'', where $HBCDIR is the value of the HBCDIR environment variable (which defaults to /usr/local/lib/lmlc if not set). If the environment variable HBCINCPATH is set this will be taken as the value of the include path instead. After this initial value of the include path has been established it can also be altered by the ``-i'' flag on the command line. Just ``-i'' flag will empty the include path. A ``-ipath'' will prepend path to the include path.
The include path is also used during linking. All files named ``lib.a'' (or ``lib_p.a'' or ``lib_ph.a'' if the ``-p'' respective ``-ph'' flags have been used) in the directories in the include path will be given to the linker. This means that a directory in the include path should contain (at least) a number of interface files, and the corresponding object files in an archive called ``lib.a''.
The interactive system uses the same mechanism for its import command. But for this to work properly the directories in the include path should also contain the object files for each of the interface files, since hbi cannot (yet) use archives.
main = putStr (hello "world" ++ "\n") hello s = "hello, " ++ sthen it can be compiled with the command
hbc Main.hs -o helloThis gives an executable file called ``hello''.