End User: The end user has identified a Haskell package (tool or library) that she wants to use.
The end user installs packages with a operating-system-specific package management system like RPM, dpkg, or FreeBSD's Ports collection.
If no such packaging system is available on her system, she, can run ./Setup.lhs install nhc or ./Setup.lhs install hugs to build, install, and register an NHC or Hugs version of the program (for instance).
Packager: A packager is someone who makes operating-system-specific packages so that an end-user can have an easier time installing them on her own system. For each platform, there should be one or more packager.
The packager can run ./Setup.lhs bdist_deb to build a skeleton Debian package (for instance) for each of the installed Haskell Implementations. This might generate Debian packages like hunit-hugs, hunit-ghc, hunit-prof-ghc, hunit-prof-nhc.
3rd Party Author: A 3rd party author is a Haskell developer (distinct from the Haskell Implementation authors or end users) who wishes to distribute a library or application that he has developed in Haskell.
The 3rd Party Author writes a
Setup.lhs program. Setup.lhs
imports elements from the Distribution
module which does most of the hard
work. A very common case, which should be our first priority, is a
pure Haskell 98 module that needn't interface with any external
systems. In this case the author only has to include the name of
the program, the version, and the source files. He can then call
Distribution.defaultMain
to create an
executable script with the proper command-line flags that knows how
to interface with the Distribution.Package
module.
Should he have a more complex program (one which
perhaps depends on systems external to Haskell), then the Distribution
module
could output a Makefile to be used in 'fptools' or Yale's system
(see Section A.6).
Should he not want to migrate from his own build system, he could write a Setup.lhs script to wrap the build system so that it conforms to the standard command-line interface.
Haskell Implementation Authors:
Haskell Implementation authors must conform to an
agreed-upon Distribution.Package
interface.
This may include writing functionality so the compiler can be asked questions about itself.
This may also include altering compilers to read /etc/haskellPackages.conf (for instance) to discover what packages are installed or where to look for imports.
Include the Distribution
module with the Haskell Implementations (in exchange, we
can hopefully remove some libraries that are currently included with
the Haskell Implementations).
Random Haskell Programmer:
A random Haskell programmer can use the
Distribution
module as a means to create layered tools that download, build,
or install packages. For instance:
haskell-config is an example of a layered tool which interfaces with
the Distribution
module. This tool gives the end user access to the database
of installed applications.
A Graphical User Interface could be layered on top of the Setup script to give installation a better look-and-feel according to the target platform.
The Distribution
module could be augmented with an online
repository of libraries (see Section A.3), and a layered tool might
perform the searching and downloading functionality of the
installation process.
Debuggers often need to locate the source code to a library module in order to instrument them.
Source code editors or browsers could benefit from being able to locate related source code on the user's system.