Unverified Commit 80984634 authored by Mikhail Glushenkov's avatar Mikhail Glushenkov Committed by GitHub
Browse files

Merge branch 'master' into issue-4443

parents 3f497f2c bf83d33e
......@@ -32,15 +32,33 @@ extra-source-files:
-- Generated with 'misc/gen-extra-source-files.sh'
-- Do NOT edit this section manually; instead, run the script.
-- BEGIN gen-extra-source-files
tests/ParserTests/errors/common1.cabal
tests/ParserTests/errors/common1.errors
tests/ParserTests/errors/common2.cabal
tests/ParserTests/errors/common2.errors
tests/ParserTests/errors/common3.cabal
tests/ParserTests/errors/common3.errors
tests/ParserTests/regressions/Octree-0.5.cabal
tests/ParserTests/regressions/Octree-0.5.format
tests/ParserTests/regressions/common.cabal
tests/ParserTests/regressions/common.format
tests/ParserTests/regressions/common2.cabal
tests/ParserTests/regressions/common2.format
tests/ParserTests/regressions/elif.cabal
tests/ParserTests/regressions/elif.format
tests/ParserTests/regressions/elif2.cabal
tests/ParserTests/regressions/elif2.format
tests/ParserTests/regressions/encoding-0.8.cabal
tests/ParserTests/regressions/encoding-0.8.format
tests/ParserTests/regressions/generics-sop.cabal
tests/ParserTests/regressions/generics-sop.format
tests/ParserTests/regressions/haddock-api-2.18.1-check.cabal
tests/ParserTests/regressions/issue-774.cabal
tests/ParserTests/regressions/issue-774.format
tests/ParserTests/regressions/nothing-unicode.cabal
tests/ParserTests/regressions/nothing-unicode.format
tests/ParserTests/regressions/shake.cabal
tests/ParserTests/regressions/shake.format
tests/ParserTests/warnings/bom.cabal
tests/ParserTests/warnings/bool.cabal
tests/ParserTests/warnings/deprecatedfield.cabal
......
......@@ -18,6 +18,7 @@ module Distribution.PackageDescription (
PackageDescription(..),
emptyPackageDescription,
specVersion,
buildType,
descCabalVersion,
BuildType(..),
knownBuildTypes,
......
......@@ -448,20 +448,20 @@ checkFields pkg =
"Package names with the prefix 'z-' are reserved by Cabal and "
++ "cannot be used."
, check (isNothing (buildType pkg)) $
, check (isNothing (buildTypeRaw pkg) && specVersion pkg < mkVersion [2,1]) $
PackageBuildWarning $
"No 'build-type' specified. If you do not need a custom Setup.hs or "
++ "./configure script then use 'build-type: Simple'."
, case buildType pkg of
Just (UnknownBuildType unknown) -> Just $
UnknownBuildType unknown -> Just $
PackageBuildWarning $
quote unknown ++ " is not a known 'build-type'. "
++ "The known build types are: "
++ commaSep (map display knownBuildTypes)
_ -> Nothing
, check (isJust (setupBuildInfo pkg) && buildType pkg /= Just Custom) $
, check (isJust (setupBuildInfo pkg) && buildType pkg /= Custom) $
PackageBuildWarning $
"Ignoring the 'custom-setup' section because the 'build-type' is "
++ "not 'Custom'. Use 'build-type: Custom' if you need to use a "
......@@ -1283,7 +1283,7 @@ checkCabalVersion pkg =
, check (specVersion pkg >= mkVersion [1,23]
&& isNothing (setupBuildInfo pkg)
&& buildType pkg == Just Custom) $
&& buildType pkg == Custom) $
PackageBuildWarning $
"Packages using 'cabal-version: >= 1.23' with 'build-type: Custom' "
++ "must use a 'custom-setup' section with a 'setup-depends' field "
......@@ -1293,7 +1293,7 @@ checkCabalVersion pkg =
, check (specVersion pkg < mkVersion [1,23]
&& isNothing (setupBuildInfo pkg)
&& buildType pkg == Just Custom) $
&& buildType pkg == Custom) $
PackageDistSuspiciousWarn $
"From version 1.23 cabal supports specifiying explicit dependencies "
++ "for Custom setup scripts. Consider using cabal-version >= 1.23 and "
......@@ -1364,7 +1364,7 @@ checkCabalVersion pkg =
, usesWildcardSyntax vr ]
depsUsingMajorBoundSyntax = [ dep | dep@(Dependency _ vr) <- buildDepends pkg
, usesMajorBoundSyntax vr ]
, usesMajorBoundSyntax vr ]
usesBackpackIncludes = any (not . null . mixins) (allBuildInfo pkg)
......@@ -1903,7 +1903,7 @@ checkSetupExists :: Monad m => CheckPackageContentOps m
-> PackageDescription
-> m (Maybe PackageCheck)
checkSetupExists ops pkg = do
let simpleBuild = buildType pkg == Just Simple
let simpleBuild = buildType pkg == Simple
hsexists <- doesFileExist ops "Setup.hs"
lhsexists <- doesFileExist ops "Setup.lhs"
return $ check (not simpleBuild && not hsexists && not lhsexists) $
......@@ -1913,13 +1913,14 @@ checkSetupExists ops pkg = do
checkConfigureExists :: Monad m => CheckPackageContentOps m
-> PackageDescription
-> m (Maybe PackageCheck)
checkConfigureExists ops PackageDescription { buildType = Just Configure } = do
exists <- doesFileExist ops "configure"
return $ check (not exists) $
PackageBuildWarning $
"The 'build-type' is 'Configure' but there is no 'configure' script. "
++ "You probably need to run 'autoreconf -i' to generate it."
checkConfigureExists _ _ = return Nothing
checkConfigureExists ops pd
| buildType pd == Configure = do
exists <- doesFileExist ops "configure"
return $ check (not exists) $
PackageBuildWarning $
"The 'build-type' is 'Configure' but there is no 'configure' script. "
++ "You probably need to run 'autoreconf -i' to generate it."
| otherwise = return Nothing
checkLocalPathsExist :: Monad m => CheckPackageContentOps m
-> PackageDescription
......
......@@ -86,7 +86,7 @@ packageDescriptionFieldGrammar = PackageDescription
<*> prefixedFields "x-" L.customFieldsPD
<*> pure [] -- build-depends
<*> optionalFieldDefAla "cabal-version" SpecVersion L.specVersionRaw (Right anyVersion)
<*> optionalField "build-type" L.buildType
<*> optionalField "build-type" L.buildTypeRaw
<*> pure Nothing -- custom-setup
-- components
<*> pure Nothing -- lib
......@@ -175,6 +175,9 @@ data TestSuiteStanza = TestSuiteStanza
, _testStanzaBuildInfo :: BuildInfo
}
instance L.HasBuildInfo TestSuiteStanza where
buildInfo = testStanzaBuildInfo
testStanzaTestType :: Lens' TestSuiteStanza (Maybe TestType)
testStanzaTestType f s = fmap (\x -> s { _testStanzaTestType = x }) (f (_testStanzaTestType s))
{-# INLINE testStanzaTestType #-}
......@@ -274,6 +277,9 @@ data BenchmarkStanza = BenchmarkStanza
, _benchmarkStanzaBuildInfo :: BuildInfo
}
instance L.HasBuildInfo BenchmarkStanza where
buildInfo = benchmarkStanzaBuildInfo
benchmarkStanzaBenchmarkType :: Lens' BenchmarkStanza (Maybe BenchmarkType)
benchmarkStanzaBenchmarkType f s = fmap (\x -> s { _benchmarkStanzaBenchmarkType = x }) (f (_benchmarkStanzaBenchmarkType s))
{-# INLINE benchmarkStanzaBenchmarkType #-}
......
......@@ -97,7 +97,7 @@ pkgDescrFieldDescrs =
specVersionRaw (\v pkg -> pkg{specVersionRaw=v})
, simpleField "build-type"
(maybe mempty disp) (fmap Just parse)
buildType (\t pkg -> pkg{buildType=t})
buildTypeRaw (\t pkg -> pkg{buildTypeRaw=t})
, simpleField "license"
disp parseLicenseQ
license (\l pkg -> pkg{license=l})
......
......@@ -42,7 +42,7 @@ import Distribution.FieldGrammar
import Distribution.PackageDescription
import Distribution.PackageDescription.FieldGrammar
import Distribution.PackageDescription.Quirks (patchQuirks)
import Distribution.Parsec.Class (parsec)
import Distribution.Parsec.Class (parsecCommaList, parsec, parsecToken)
import Distribution.Parsec.Common
import Distribution.Parsec.ConfVar (parseConditionConfVar)
import Distribution.Parsec.Field (FieldName, getName)
......@@ -52,6 +52,7 @@ import Distribution.Parsec.ParseResult
import Distribution.Simple.Utils (die', fromUTF8BS, warn)
import Distribution.Text (display)
import Distribution.Types.CondTree
import Distribution.Types.Dependency (Dependency)
import Distribution.Types.ForeignLib
import Distribution.Types.UnqualComponentName
(UnqualComponentName, mkUnqualComponentName)
......@@ -62,6 +63,7 @@ import Distribution.Version
import System.Directory (doesFileExist)
import Distribution.Compat.Lens
import qualified Distribution.Types.BuildInfo.Lens as L
import qualified Distribution.Types.GenericPackageDescription.Lens as L
import qualified Distribution.Types.PackageDescription.Lens as L
......@@ -124,7 +126,21 @@ fieldlinesToBS :: [FieldLine ann] -> BS.ByteString
fieldlinesToBS = BS.intercalate "\n" . map (\(FieldLine _ bs) -> bs)
-- Monad in which sections are parsed
type SectionParser = StateT GenericPackageDescription ParseResult
type SectionParser = StateT SectionS ParseResult
-- | State of section parser
data SectionS = SectionS
{ _stateGpd :: !GenericPackageDescription
, _stateCommonStanzas :: !(Map String CondTreeBuildInfo)
}
stateGpd :: Lens' SectionS GenericPackageDescription
stateGpd f (SectionS gpd cs) = (\x -> SectionS x cs) <$> f gpd
{-# INLINE stateGpd #-}
stateCommonStanzas :: Lens' SectionS (Map String CondTreeBuildInfo)
stateCommonStanzas f (SectionS gpd cs) = SectionS gpd <$> f cs
{-# INLINE stateCommonStanzas #-}
-- Note [Accumulating parser]
--
......@@ -147,9 +163,10 @@ parseGenericPackageDescription' lexWarnings fs = do
-- Sections
let gpd = emptyGpd & L.packageDescription .~ pd
-- elif conditional is accepted if spec version is >= 2.1
let hasElif = if specVersion pd >= mkVersion [2,1] then HasElif else NoElif
execStateT (goSections hasElif sectionFields) gpd
-- parse sections
view stateGpd <$> execStateT
(goSections (specVersion pd) sectionFields)
(SectionS gpd Map.empty)
where
emptyGpd :: GenericPackageDescription
emptyGpd = GenericPackageDescription emptyPackageDescription [] Nothing [] [] [] [] []
......@@ -180,9 +197,14 @@ parseGenericPackageDescription' lexWarnings fs = do
maybeWarnCabalVersion _ _ = return ()
-- Sections
goSections :: HasElif -> [Field Position] -> SectionParser ()
goSections hasElif = traverse_ process
goSections :: Version -> [Field Position] -> SectionParser ()
goSections sv = traverse_ process
where
hasElif = if sv >= mkVersion [2,1] then HasElif else NoElif
-- Common stanzas are avaiable since cabal-version: 2.1
hasCommonStanzas = sv >= mkVersion [2,1]
process (Field (Name pos name) _) =
lift $ parseWarning pos PWTTrailingFields $
"Ignoring trailing fields after sections: " ++ show name
......@@ -193,55 +215,75 @@ goSections hasElif = traverse_ process
parseSection :: Name Position -> [SectionArg Position] -> [Field Position] -> SectionParser ()
parseSection (Name pos name) args fields
| not hasCommonStanzas, name == "common" = lift $ do
parseWarning pos PWTUnknownSection $ "Ignoring section: common. You should set cabal-version: 2.2 or larger to use common stanzas."
| name == "common" = do
commonStanzas <- use stateCommonStanzas
name' <- lift $ parseCommonName pos args
biTree <- lift $ parseCondTreeWithCommonStanzas hasElif hasCommonStanzas buildInfoFieldGrammar commonStanzas fields
case Map.lookup name' commonStanzas of
Nothing -> stateCommonStanzas .= Map.insert name' biTree commonStanzas
Just _ -> lift $ parseFailure pos $
"Duplicate common stanza: " ++ name'
| name == "library" && null args = do
lib <- lift $ parseCondTree hasElif (libraryFieldGrammar Nothing) (targetBuildDepends . libBuildInfo) fields
commonStanzas <- use stateCommonStanzas
lib <- lift $ parseCondTreeWithCommonStanzas hasElif hasCommonStanzas (libraryFieldGrammar Nothing) commonStanzas fields
-- TODO: check that library is defined once
L.condLibrary ?= lib
stateGpd . L.condLibrary ?= lib
-- Sublibraries
-- TODO: check cabal-version
| name == "library" = do
-- TODO: check cabal-version
commonStanzas <- use stateCommonStanzas
name' <- parseUnqualComponentName pos args
lib <- lift $ parseCondTree hasElif (libraryFieldGrammar $ Just name') (targetBuildDepends . libBuildInfo) fields
lib <- lift $ parseCondTreeWithCommonStanzas hasElif hasCommonStanzas (libraryFieldGrammar $ Just name') commonStanzas fields
-- TODO check duplicate name here?
L.condSubLibraries %= snoc (name', lib)
stateGpd . L.condSubLibraries %= snoc (name', lib)
-- TODO: check cabal-version
| name == "foreign-library" = do
commonStanzas <- use stateCommonStanzas
name' <- parseUnqualComponentName pos args
flib <- lift $ parseCondTree hasElif (foreignLibFieldGrammar name') (targetBuildDepends . foreignLibBuildInfo) fields
flib <- lift $ parseCondTreeWithCommonStanzas hasElif hasCommonStanzas (foreignLibFieldGrammar name') commonStanzas fields
-- TODO check duplicate name here?
L.condForeignLibs %= snoc (name', flib)
stateGpd . L.condForeignLibs %= snoc (name', flib)
| name == "executable" = do
commonStanzas <- use stateCommonStanzas
name' <- parseUnqualComponentName pos args
exe <- lift $ parseCondTree hasElif (executableFieldGrammar name') (targetBuildDepends . buildInfo) fields
exe <- lift $ parseCondTreeWithCommonStanzas hasElif hasCommonStanzas (executableFieldGrammar name') commonStanzas fields
-- TODO check duplicate name here?
L.condExecutables %= snoc (name', exe)
stateGpd . L.condExecutables %= snoc (name', exe)
| name == "test-suite" = do
commonStanzas <- use stateCommonStanzas
name' <- parseUnqualComponentName pos args
testStanza <- lift $ parseCondTree hasElif testSuiteFieldGrammar (targetBuildDepends . _testStanzaBuildInfo) fields
testStanza <- lift $ parseCondTreeWithCommonStanzas hasElif hasCommonStanzas testSuiteFieldGrammar commonStanzas fields
testSuite <- lift $ traverse (validateTestSuite pos) testStanza
-- TODO check duplicate name here?
L.condTestSuites %= snoc (name', testSuite)
stateGpd . L.condTestSuites %= snoc (name', testSuite)
| name == "benchmark" = do
commonStanzas <- use stateCommonStanzas
name' <- parseUnqualComponentName pos args
benchStanza <- lift $ parseCondTree hasElif benchmarkFieldGrammar (targetBuildDepends . _benchmarkStanzaBuildInfo) fields
benchStanza <- lift $ parseCondTreeWithCommonStanzas hasElif hasCommonStanzas benchmarkFieldGrammar commonStanzas fields
bench <- lift $ traverse (validateBenchmark pos) benchStanza
-- TODO check duplicate name here?
L.condBenchmarks %= snoc (name', bench)
stateGpd . L.condBenchmarks %= snoc (name', bench)
| name == "flag" = do
name' <- parseName pos args
name'' <- lift $ runFieldParser' pos parsec name' `recoverWith` mkFlagName ""
flag <- lift $ parseFields fields (flagFieldGrammar name'')
-- Check default flag
L.genPackageFlags %= snoc flag
stateGpd . L.genPackageFlags %= snoc flag
| name == "custom-setup" && null args = do
sbi <- lift $ parseFields fields (setupBInfoFieldGrammar False)
L.packageDescription . L.setupBuildInfo ?= sbi
stateGpd . L.packageDescription . L.setupBuildInfo ?= sbi
| name == "source-repository" = do
kind <- lift $ case args of
......@@ -255,12 +297,13 @@ goSections hasElif = traverse_ process
pure RepoHead
sr <- lift $ parseFields fields (sourceRepoFieldGrammar kind)
L.packageDescription . L.sourceRepos %= snoc sr
stateGpd . L.packageDescription . L.sourceRepos %= snoc sr
| otherwise = lift $
parseWarning pos PWTUnknownSection $ "Ignoring section: " ++ show name
parseName :: Position -> [SectionArg Position] -> SectionParser String
-- TODO: use strict parser
parseName pos args = case args of
[SecArgName _pos secName] ->
pure $ fromUTF8BS secName
......@@ -274,6 +317,20 @@ parseName pos args = case args of
lift $ parseFailure pos $ "Invalid name " ++ show args
pure ""
parseCommonName :: Position -> [SectionArg Position] -> ParseResult String
parseCommonName pos args = case args of
[SecArgName _pos secName] ->
pure $ fromUTF8BS secName
[SecArgStr _pos secName] ->
pure $ fromUTF8BS secName
[] -> do
parseFailure pos $ "name required"
pure ""
_ -> do
-- TODO: pretty print args
parseFailure pos $ "Invalid name " ++ show args
pure ""
parseUnqualComponentName :: Position -> [SectionArg Position] -> SectionParser UnqualComponentName
parseUnqualComponentName pos args = mkUnqualComponentName <$> parseName pos args
......@@ -291,7 +348,6 @@ warnInvalidSubsection :: Section Position -> ParseResult ()
warnInvalidSubsection (MkSection (Name pos name) _ _) =
void (parseFailure pos $ "invalid subsection " ++ show name)
data HasElif = HasElif | NoElif
deriving (Eq, Show)
......@@ -333,6 +389,8 @@ parseCondTree hasElif grammar cond = go
sections' <- parseIfs sections
return (Just elseFields, sections')
parseElseIfs (MkSection (Name _ name) test fields : sections) | hasElif == HasElif, name == "elif" = do
-- TODO: check cabal-version
test' <- parseConditionConfVar test
......@@ -342,6 +400,10 @@ parseCondTree hasElif grammar cond = go
a <- parseFieldGrammar mempty grammar
return (Just $ CondNode a (cond a) [CondBranch test' fields' elseFields], sections')
parseElseIfs (MkSection (Name pos name) _ _ : sections) | name == "elif" = do
parseWarning pos PWTInvalidSubsection $ "invalid subsection \"elif\". You should set cabal-version: 2.2 or larger to use elif-conditionals."
(,) Nothing <$> parseIfs sections
parseElseIfs sections = (,) Nothing <$> parseIfs sections
{- Note [Accumulating parser]
......@@ -366,6 +428,111 @@ When/if we re-implement the parser to support formatting preservging roundtrip
with new AST, this all need to be rewritten.
-}
-------------------------------------------------------------------------------
-- Common stanzas
-------------------------------------------------------------------------------
-- $commonStanzas
--
-- [Note: Common stanzas]
--
-- In Cabal 2.2 we support simple common stanzas:
--
-- * Commons stanzas define 'BuildInfo'
--
-- * import "fields" can only occur at top of other stanzas (think: imports)
--
-- In particular __there aren't__
--
-- * implicit stanzas
--
-- * More specific common stanzas (executable, test-suite).
--
--
-- The approach uses the fact that 'BuildInfo' is a 'Monoid':
--
-- @
-- mergeCommonStanza' :: HasBuildInfo comp => BuildInfo -> comp -> comp
-- mergeCommonStanza' bi = over L.BuildInfo (bi <>)
-- @
--
-- Real 'mergeCommonStanza' is more complicated as we have to deal with
-- conditional trees.
--
-- The approach is simple, and have good properties:
--
-- * Common stanzas are parsed exactly once, even if not-used. Thus we report errors in them.
--
type CondTreeBuildInfo = CondTree ConfVar [Dependency] BuildInfo
-- | Create @a@ from 'BuildInfo'.
--
-- Law: @view buildInfo . fromBuildInfo = id@
class L.HasBuildInfo a => FromBuildInfo a where
fromBuildInfo :: BuildInfo -> a
instance FromBuildInfo BuildInfo where fromBuildInfo = id
instance FromBuildInfo Library where fromBuildInfo bi = set L.buildInfo bi emptyLibrary
instance FromBuildInfo ForeignLib where fromBuildInfo bi = set L.buildInfo bi emptyForeignLib
instance FromBuildInfo Executable where fromBuildInfo bi = set L.buildInfo bi emptyExecutable
instance FromBuildInfo TestSuiteStanza where
fromBuildInfo = TestSuiteStanza Nothing Nothing Nothing
instance FromBuildInfo BenchmarkStanza where
fromBuildInfo = BenchmarkStanza Nothing Nothing Nothing
parseCondTreeWithCommonStanzas
:: forall a. FromBuildInfo a
=> HasElif -- ^ accept @elif@
-> Bool -- ^ accept @import@
-> ParsecFieldGrammar' a -- ^ grammar
-> Map String CondTreeBuildInfo -- ^ common stanzas
-> [Field Position]
-> ParseResult (CondTree ConfVar [Dependency] a)
parseCondTreeWithCommonStanzas hasElif hasCommonStanzas grammar commonStanzas = goImports []
where
-- parse leading imports
-- not supported:
goImports acc (Field (Name pos name) _ : fields) | name == "import", not hasCommonStanzas = do
parseWarning pos PWTUnknownField "Unknown field: import. You should set cabal-version: 2.2 or larger to use common stanzas"
goImports acc fields
-- supported:
goImports acc (Field (Name pos name) fls : fields) | name == "import" = do
names <- runFieldParser pos (parsecCommaList parsecToken) fls
names' <- for names $ \commonName ->
case Map.lookup commonName commonStanzas of
Nothing -> do
parseFailure pos $ "Undefined common stanza imported: " ++ commonName
pure Nothing
Just commonTree ->
pure (Just commonTree)
goImports (acc ++ catMaybes names') fields
-- Go to parsing condTree after first non-import 'Field'.
goImports acc fields = go acc fields
-- parse actual CondTree
go :: [CondTreeBuildInfo] -> [Field Position] -> ParseResult (CondTree ConfVar [Dependency] a)
go bis fields = do
x <- parseCondTree hasElif grammar (view L.targetBuildDepends) fields
pure $ foldr mergeCommonStanza x bis
mergeCommonStanza
:: forall a. FromBuildInfo a
=> CondTree ConfVar [Dependency] BuildInfo
-> CondTree ConfVar [Dependency] a
-> CondTree ConfVar [Dependency] a
mergeCommonStanza (CondNode bi _ bis) (CondNode x _ cs) =
CondNode x' (x' ^. L.targetBuildDepends) cs'
where
-- new value is old value with buildInfo field _prepended_.
x' = x & L.buildInfo %~ (bi <>)
-- tree components are appended together.
cs' = map (fmap fromBuildInfo) bis ++ cs
-------------------------------------------------------------------------------
-- Old syntax
-------------------------------------------------------------------------------
......
......@@ -63,8 +63,9 @@ data P sep = P
class Sep sep where
prettySep :: P sep -> [Doc] -> Doc
parseSep
:: P sep -> P.Stream s Identity Char
=> P.Parsec s [PWarning] a
:: P.Stream s Identity Char
=> P sep
-> P.Parsec s [PWarning] a
-> P.Parsec s [PWarning] [a]
instance Sep CommaVCat where
......
......@@ -221,7 +221,7 @@ elements ilevel = many (element ilevel)
-- An individual element, ie a field or a section. These can either use
-- layout style or braces style. For layout style then it must start on
-- a line on its own (so that we know its indentation level).
--
-- element ::= '\n' name elementInLayoutContext
-- | name elementInNonLayoutContext
......
......@@ -11,7 +11,7 @@
-- Portability : portable
--
-- This should be a much more sophisticated abstraction than it is. Currently
-- it's just a bit of data about the compiler, like it's flavour and name and
-- it's just a bit of data about the compiler, like its flavour and name and
-- version. The reason it's just data is because currently it has to be in
-- 'Read' and 'Show' so it can be saved along with the 'LocalBuildInfo'. The
-- only interesting bit of info it contains is a mapping between language
......
......@@ -501,7 +501,7 @@ profDetailLevelFlag forLib mpl =
-- -----------------------------------------------------------------------------
-- GHC platform and version strings
-- | GHC's rendering of it's host or target 'Arch' as used in its platform
-- | GHC's rendering of its host or target 'Arch' as used in its platform
-- strings and certain file locations (such as user package db location).
--
ghcArchString :: Arch -> String
......@@ -509,7 +509,7 @@ ghcArchString PPC = "powerpc"
ghcArchString PPC64 = "powerpc64"
ghcArchString other = display other
-- | GHC's rendering of it's host or target 'OS' as used in its platform
-- | GHC's rendering of its host or target 'OS' as used in its platform
-- strings and certain file locations (such as user package db location).
--
ghcOsString :: OS -> String
......@@ -518,7 +518,7 @@ ghcOsString OSX = "darwin"
ghcOsString Solaris = "solaris2"
ghcOsString other = display other
-- | GHC's rendering of it's platform and compiler version string as used in
-- | GHC's rendering of its platform and compiler version string as used in
-- certain file locations (such as user package db location).
-- For example @x86_64-linux-7.10.4@
--
......
......@@ -466,7 +466,7 @@ ppHsc2hs bi lbi clbi =
_ -> id
-- We don't link in the actual Haskell libraries of our dependencies, so
-- the -u flags in the ldOptions of the rts package mean linking fails on
-- OS X (it's ld is a tad stricter than gnu ld). Thus we remove the
-- OS X (its ld is a tad stricter than gnu ld). Thus we remove the
-- ldOptions for GHC's rts package:
hackRtsPackage index =
case PackageIndex.lookupPackageName index (mkPackageName "rts") of
......
......@@ -71,7 +71,7 @@ data GhcOptions = GhcOptions {
ghcOptOutputDynFile :: Flag FilePath,
-- | Start with an empty search path for Haskell source files;
-- the @ghc -i@ flag (@-i@ on it's own with no path argument).
-- the @ghc -i@ flag (@-i@ on its own with no path argument).
ghcOptSourcePathClear :: Flag Bool,
-- | Search path for Haskell source files; the @ghc -i@ flag.
......
......@@ -8,7 +8,7 @@
-- Portability : portable
--
-- This defines a 'Text' class which is a bit like the 'Read' and 'Show'
-- classes. The difference is that is uses a modern pretty printer and parser
-- classes. The difference is that it uses a modern pretty printer and parser
-- system and the format is not expected to be Haskell concrete syntax but
-- rather the external human readable representation used by Cabal.
--
......
......@@ -30,6 +30,7 @@ module Distribution.Types.PackageDescription (
PackageDescription(..),
specVersion,
d