diff options
author | simonmar <unknown> | 2002-12-18 16:29:34 +0000 |
---|---|---|
committer | simonmar <unknown> | 2002-12-18 16:29:34 +0000 |
commit | 854ab9a44c4f9a9cb6239bb0af14c150b0e454c6 (patch) | |
tree | ba572fa1774d179672f2dfc2bb0eb2f591a49941 /ghc/utils | |
parent | f6ba57ea88bdc30e3f19ca1c8ddd3180377ac219 (diff) | |
download | haskell-854ab9a44c4f9a9cb6239bb0af14c150b0e454c6.tar.gz |
[project @ 2002-12-18 16:29:25 by simonmar]
"Auto" packages.
The big change here is that it is no longer necessary to explicitly
say '-package X' on the command line if X is a package containing
hierarchical Haskell modules. All packages marked "auto" contribute
to the import path, so their modules are always available. At link
time, the compiler knows which packages are actually used by the
program, and it links in only those libraries needed.
There's one exception: one-shot linking. If you link a program using
ghc -o prog A.o B.o ...
then you need to explicitly add -package flags for each package
required (except base & haskell98) because the compiler has no
information about the package dependencies in this case.
Package configs have a new field: auto, which is either True or False.
Non-auto packages must be mentioned on the command-line as usual.
Non-auto packages are still required for:
- non-hierarchical libraries (to avoid polluting the module namespace)
- packages with no Haskell content
- if you want more than one version of a package, or packages
providing overlapping functionality where the user must decide
which one to use.
Doc changes to follow...
Diffstat (limited to 'ghc/utils')
-rw-r--r-- | ghc/utils/ghc-pkg/Package.hs | 5 | ||||
-rw-r--r-- | ghc/utils/ghc-pkg/ParsePkgConfLite.y | 10 |
2 files changed, 14 insertions, 1 deletions
diff --git a/ghc/utils/ghc-pkg/Package.hs b/ghc/utils/ghc-pkg/Package.hs index 2fb7690754..bd9e226a79 100644 --- a/ghc/utils/ghc-pkg/Package.hs +++ b/ghc/utils/ghc-pkg/Package.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: Package.hs,v 1.5 2002/09/09 12:10:01 simonmar Exp $ +-- $Id: Package.hs,v 1.6 2002/12/18 16:29:34 simonmar Exp $ -- -- Package configuration defn. ----------------------------------------------------------------------------- @@ -27,6 +27,7 @@ import Pretty data PackageConfig = Package { name :: String, + auto :: Bool, import_dirs :: [String], source_dirs :: [String], library_dirs :: [String], @@ -45,6 +46,7 @@ data PackageConfig defaultPackageConfig = Package { name = error "defaultPackage", + auto = False, import_dirs = [], source_dirs = [], library_dirs = [], @@ -76,6 +78,7 @@ dumpPkgGuts pkg = text "Package" $$ nest 3 (braces ( sep (punctuate comma [ text "name = " <> text (show (name pkg)), + text "auto = " <> text (show (auto pkg)), dumpField "import_dirs" (import_dirs pkg), dumpField "source_dirs" (source_dirs pkg), dumpField "library_dirs" (library_dirs pkg), diff --git a/ghc/utils/ghc-pkg/ParsePkgConfLite.y b/ghc/utils/ghc-pkg/ParsePkgConfLite.y index 152ff9b517..d4d8ddbf6a 100644 --- a/ghc/utils/ghc-pkg/ParsePkgConfLite.y +++ b/ghc/utils/ghc-pkg/ParsePkgConfLite.y @@ -48,6 +48,11 @@ field :: { PackageConfig -> PackageConfig } "name" -> p{name = $3} _ -> error "unknown key in config file" } + | VARID '=' bool + {\p -> case $1 of { + "auto" -> p{auto = $3}; + _ -> p } } + | VARID '=' strlist {\p -> case $1 of "import_dirs" -> p{import_dirs = $3} @@ -73,6 +78,11 @@ strs :: { [String] } : STRING { [ $1 ] } | strs ',' STRING { $3 : $1 } +bool :: { Bool } + : CONID {% case $1 of { + "True" -> True; + "False" -> False; + _ -> error ("unknown constructor in config file: " ++ $1) } } { data Token = ITocurly |