<A HREF="manual_c.htm"><img align=center src="contents.gif" ALT="Contents"></A> Up Previous Next

Load project :project [<project file>]


Project files were originally introduced to ease the task of working with programs whose source code was spread over several files, all of which had to be loaded at the same time. The new facilities for import chasing usually provide a much better way to deal with multiple file projects, but the current version of Hugs 1.4 does still support the use of project files.

The :project command takes a single argument; the name of a text file containing a list of file names, separated from one another by whitespace (which may include spaces, newlines, or Haskell-style comments). For example, the following is a valid project file:

 {- A simple project file, Demo.prj -}
 Types   -- datatype definitions
 Basics  -- basic operations
 Main    -- the main program
If we load this into Hugs with a command :project Demo.prj, then the interpreter will read the project file and then try to load each of the named files. In this particular case, the overall effect is, essentially, the same as that of:
 :load Types Basics Main
Once a project file has been selected, the :project command (without any arguments) can be used to force Hugs to reread both the project file and the module files that it lists. This might be useful if, for example, the project file itself has been modified since it was first read.

Project file names may also be specified on the command line when the interpreter is invoked by preceding the project file name with a single + character. Note that there must be at least one space on each side of the +. Standard command line options can also be used at the same time, but additional filename arguments will be ignored. Starting Hugs with a command of the form hugs + Demo.prj is equivalent to starting Hugs without any arguments and then giving the command :p Demo.prj.

The :project command uses the same mechanisms as :load to locate the files mentioned in a project file, but it will not use the current path to locate the project file itself; you must specify a full pathname.

As has already been said, import chasing usually provides a much better way to deal with multiple file programs than the old project file system. The big advantage of import chasing is that dependencies between modules are documented within individual modules, leaving the system free to determine the order in which the files should be loaded. For example, if the Main module in the example above actually needs the definitions in Types and Basics, then this will be documented by import statements, and the whole program could be loaded with a single :load Main command.