diff options
| author | Edward Z. Yang <ezyang@cs.stanford.edu> | 2015-03-09 13:52:40 -0700 |
|---|---|---|
| committer | Edward Z. Yang <ezyang@cs.stanford.edu> | 2015-03-10 10:54:20 -0700 |
| commit | 8a91079b5895c1505717b5d401617269720ad8ab (patch) | |
| tree | cf487955ae74a086c9be1b4aa35e3f41703eedee /compiler | |
| parent | b03479dccf3eaddb56db0f48c666c946c4d0f275 (diff) | |
| download | haskell-8a91079b5895c1505717b5d401617269720ad8ab.tar.gz | |
Documentation for PackageArg/ModRenaming/PackageFlag
Summary:
[skip-ci]
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: austin, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D723
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/main/DynFlags.hs | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 74e0ce6cf5..aa6b7f9308 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -1104,20 +1104,40 @@ isNoLink :: GhcLink -> Bool isNoLink NoLink = True isNoLink _ = False -data PackageArg = PackageArg String - | PackageIdArg String - | PackageKeyArg String +-- | We accept flags which make packages visible, but how they select +-- the package varies; this data type reflects what selection criterion +-- is used. +data PackageArg = + PackageArg String -- ^ @-package@, by 'PackageName' + | PackageIdArg String -- ^ @-package-id@, by 'SourcePackageId' + | PackageKeyArg String -- ^ @-package-key@, by 'InstalledPackageId' deriving (Eq, Show) -data ModRenaming = ModRenaming Bool [(ModuleName, ModuleName)] - deriving (Eq) - +-- | Represents the renaming that may be associated with an exposed +-- package, e.g. the @rns@ part of @-package "foo (rns)"@. +-- +-- Here are some example parsings of the package flags (where +-- a string literal is punned to be a 'ModuleName': +-- +-- * @-package foo@ is @ModRenaming True []@ +-- * @-package foo ()@ is @ModRenaming False []@ +-- * @-package foo (A)@ is @ModRenaming False [("A", "A")]@ +-- * @-package foo (A as B)@ is @ModRenaming False [("A", "B")]@ +-- * @-package foo with (A as B)@ is @ModRenaming True [("A", "B")]@ +data ModRenaming = ModRenaming { + modRenamingWithImplicit :: Bool, -- ^ Bring all exposed modules into scope? + modRenamings :: [(ModuleName, ModuleName)] -- ^ Bring module @m@ into scope + -- under name @n@. + } deriving (Eq) + +-- | Flags for manipulating packages. data PackageFlag - = ExposePackage PackageArg ModRenaming - | HidePackage String - | IgnorePackage String - | TrustPackage String - | DistrustPackage String + = ExposePackage PackageArg ModRenaming -- ^ @-package@, @-package-id@ + -- and @-package-key@ + | HidePackage String -- ^ @-hide-package@ + | IgnorePackage String -- ^ @-ignore-package@ + | TrustPackage String -- ^ @-trust-package@ + | DistrustPackage String -- ^ @-distrust-package@ deriving (Eq) defaultHscTarget :: Platform -> HscTarget |
