Changes between Version 2 and Version 3 of SourceGuide

Show
Ignore:
Timestamp:
01/25/08 09:26:29 (5 years ago)
Author:
duncan
Comment:

Add more content and use definition list syntax.

Legend:

Unmodified
Added
Removed
Modified
  • SourceGuide

    v2 v3  
    77All the Cabal modules live under `Distribution.*` 
    88 
    9 The modules can be roughly divided into to groups, the 'declarative' part and the 'active' part: 
     9The modules can be roughly divided into two groups: 
    1010 
    11  * The 'declarative' modules `Distribution.*` - they are mostly concerned with data structures like package descriptions. 
     11 The '''declarative''' modules:: 
     12  They are mostly concerned with data structures like package descriptions. These modules live under `Distribution.*`. 
     13  Much of the code in these modules are utility functions for handling the data types and also functions for parsing and showing them. 
    1214 
    13  * The 'active' modules `Distribution.Simple.*` - they are concerned with actually doing things like configuring, building and installing packages. 
     15 The '''active''' modules:: 
     16  They are concerned with actually doing things like configuring, building and installing packages. These modules live under `Distribution.Simple.*`. 
    1417 
    1518=== Declarative modules === 
    1619 
    17  * Distribution/GetOpt.hs - This should live under Compat/ it's just a bundled version of the standard GetOpt. Not very interesting. 
    18  * Distribution/Setup.hs  - This is a deprecated module here just so that old Setup.hs scripts do not break. Ignore it. 
     20A couple really dull modules 
    1921 
    20  * Distribution/Version.hs - exports the `Version` type  along with a parser and pretty printer. A version is something like "1.3.3". It also defines `VersionRange`s and `Dependency` data types. Version ranges are like ">= 1.2 && < 2". A dependency is a package name and a version range, like "foo >= 1.2 && < 2". 
    21  * Distribution/Package.hs - defines a package identifier along with a parser and pretty printer for it. `PackageIdentifier`s consist of a name and an exact version (exact as opposed to a dependency like above). 
     22 `Distribution/GetOpt.hs`:: 
     23  This should live under Compat/ it's just a bundled version of the standard !GetOpt. Not very interesting. 
    2224 
    23  * Distribution/Verbosity.hs - a simple `Verbosity` type with associated utilities. There are 4 standard verbosity levels from `Silent`, `Normal`,  `Verbose` up to `Deafening`. This is used for deciding what logging messages to print in the active parts. 
    24  * Distribution/Compiler.hs 
    25  * Distribution/System.hs 
    26  * Distribution/Extension.hs 
    27  * Distribution/License.hs 
     25 `Distribution/Setup.hs`:: 
     26  This is a deprecated module here just so that old `Setup.hs` scripts do not break. Ignore it. 
    2827 
    29  * Distribution/ParseUtils.hs 
     28 `Distribution/Extension.hs`:: 
     29  This is also a deprecated module here just so that old code does not break. The module got renamed to `Language.Haskell.Extension`. 
     30 
     31Some simple data types: 
     32 
     33 `Distribution/Version.hs`:: 
     34  exports the `Version` type  along with a parser and pretty printer. A version is something like "1.3.3". It also defines `VersionRange`s and 
     35  `Dependency` data types. Version ranges are like ">= 1.2 && < 2". A dependency is a package name and a version range, like "foo >= 1.2 && < 2". 
     36 
     37 `Distribution/Package.hs`:: 
     38  defines a package identifier along with a parser and pretty printer for it. `PackageIdentifier`s consist of a name and an exact version 
     39 (exact version as opposed to a dependency like above that uses a version range). 
     40 
     41 `Distribution/Verbosity.hs`:: 
     42  a simple `Verbosity` type with associated utilities. There are 4 standard verbosity levels from `Silent`, `Normal`,  `Verbose` up to `Deafening`. 
     43  This is used for deciding what logging messages to print in the active parts. 
     44 `Distribution/Compiler.hs`:: 
     45  This has an enumeration of the various compilers that Cabal knows about. It also specifies the default compiler. Sadly you'll often see code  
     46  that does case analysis on this compiler flavour enumeration like: 
     47  {{{ 
     48  case compilerFlavor comp of 
     49    GHC -> GHC.getInstalledPackages verbosity packageDb progconf 
     50    JHC -> JHC.getInstalledPackages verbosity packageDb progconf 
     51 
     52  }}} 
     53  Obviously it would be better to use the proper `Compiler` abstraction because that would keep all the compiler-specific code together. 
     54  Unfortunately we cannot make this change yet without breaking the `UserHooks` api, which would break all custom `Setup.hs` files, so for the 
     55  moment we just have to live with this deffeciency. If you're interested, see ticket #50. 
     56 
     57 `Distribution/System.hs`:: 
     58  Cabal often needs to do slightly different things on specific platforms. You probably know about the `System.Info.os :: String` however using 
     59  that is very inconvenient because it is a string and different Haskell implementations do not agree on using the same strings for the same 
     60  platforms! (In particular see the controversy over "windows" vs "ming32"). So to make it more consistent and easy to use we have an `OS` 
     61  enumeration. 
     62 
     63 `Distribution/License.hs`:: 
     64  The `.cabal` file allows you to specify a license file. Of course you can use any license you like but people often pick common open source 
     65  licenses and it's useful if we can automatically recognise that (eg so we can display it on the hackage web pages). So you can also specify the 
     66  license itself in the `.cabal` file from a short enumeration defined in this module. It includes `GPL`, `LGPL` and `BSD3` licenses. 
     67 
     68 `Distribution/ParseUtils.hs`:: 
     69  The `.cabal` file format is not trivial, especially with the introduction of configurations and the section syntax that goes with that. 
     70  This module has a bunch of parsing functions that is used by the `.cabal` parser and a couple others. It has the parsing framework code and 
     71  also little parsers for many of the formats we get in various `.cabal` file fields, like module names, comma separated lists etc. 
     72 
    3073 * Distribution/PackageDescription.hs 
    3174 * Distribution/Configuration.hs