[Haskell] URLs in haskell module namespace

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Wed Mar 23 17:19:10 EST 2005

Here is what I designed and implemented for my language Kogut:

There is a file format of compilation parameters (compiler options,
source file encoding, directories to look for interface files for
imported modules, directories to look for libraries, C libraries
to link, directories to look for packages, packages used).

Parameters are gathered from several places:
- From the command line (in a slightly different format than a file).
- From the file name derived from the source file, with a changed
- From "common.kop" in the directory of the source file.
- From "common.kop" in parent directories of the source, up to the
  current directory.
- From used packages. A package actually corresponds to such parameter
  file, nothing else. Packages are included in the global dependency
  order, with duplicates removed.
- From the default file in the compiler installation.

Some parameters are accumulated (e.g. directory lists or libraries;
with duplicates removed; the order is important for static libraries)
while others are overridden (e.g. the C compiler to use).

So if a package is needed to bring one module used in one place,
it can be specified near the file which needs it (and there is
less chance that the dependency will stick forgotten when no longer
needed). OTOH a package used all over the place will be given in the
common.kop in the root of the directory tree.

A package usually has two parameter files: one common.kop used during
its compilation, and another named after the package which is used by
its clients.

Since compilation options can be put in parameter files corresponding
to source files, it's not necessary to invent a way to specify them
per-file in Makefiles.

   __("<         Marcin Kowalczyk
   \__/       qrczak at knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/

More information about the Haskell mailing list