@@ -201,15 +201,8 @@ import qualified Data.Set as Set
201
201
import Network.URI (URI (.. ), nullURIAuth , parseURI )
202
202
import System.Directory (createDirectoryIfMissing , makeAbsolute )
203
203
import System.FilePath (isAbsolute , isPathSeparator , makeValid , splitFileName , (</>) )
204
- import Text.PrettyPrint
205
- ( Doc
206
- , render
207
- , semi
208
- , text
209
- , vcat
210
- , ($+$)
211
- )
212
- import qualified Text.PrettyPrint as Disp (empty , int , render , text )
204
+ import Text.PrettyPrint (Doc , int , render , semi , text , vcat , ($+$) )
205
+ import qualified Text.PrettyPrint as Disp (empty )
213
206
214
207
------------------------------------------------------------------
215
208
-- Handle extended project config files with conditionals and imports.
@@ -286,7 +279,7 @@ type DupesMap = Map FilePath [Dupes]
286
279
dupesMsg :: (FilePath , [Dupes ]) -> Doc
287
280
dupesMsg (duplicate, ds@ (take 1 . sortOn dupesNormLocPath -> dupes)) =
288
281
vcat $
289
- ((text " Warning:" <+> Disp. int (length ds) <+> text " imports of" <+> text duplicate) <> semi)
282
+ ((text " Warning:" <+> int (length ds) <+> text " imports of" <+> text duplicate) <> semi)
290
283
: ((\ Dupes {.. } -> duplicateImportMsg Disp. empty dupesUniqueImport dupesNormLocPath dupesSeenImportsBy) <$> dupes)
291
284
292
285
parseProjectSkeleton
@@ -326,7 +319,7 @@ parseProjectSkeleton cacheDir httpTransport verbosity importsBy dupesMap project
326
319
else do
327
320
when
328
321
(isUntrimmedUriConfigPath importLocPath)
329
- (noticeDoc verbosity $ untrimmedUriImportMsg (Disp. text " Warning:" ) importLocPath)
322
+ (noticeDoc verbosity $ untrimmedUriImportMsg (text " Warning:" ) importLocPath)
330
323
let fs = (\ z -> CondNode z [normLocPath] mempty ) <$> fieldsToConfig normSource (reverse acc)
331
324
let uniqueFields = if uniqueImport `elem` seenImports then [] else xs
332
325
atomicModifyIORef' dupesMap $ \ dm -> (Map. insertWith (++) uniqueImport [Dupes uniqueImport normLocPath seenImportsBy] dm, () )
@@ -1324,13 +1317,13 @@ parseLegacyProjectConfig rootConfig bs =
1324
1317
1325
1318
showLegacyProjectConfig :: LegacyProjectConfig -> String
1326
1319
showLegacyProjectConfig config =
1327
- Disp. render $
1320
+ render $
1328
1321
showConfig
1329
1322
(legacyProjectConfigFieldDescrs constraintSrc)
1330
1323
legacyPackageConfigSectionDescrs
1331
1324
legacyPackageConfigFGSectionDescrs
1332
1325
config
1333
- $+$ Disp. text " "
1326
+ $+$ text " "
1334
1327
where
1335
1328
-- Note: ConstraintSource is unused when pretty-printing. We fake
1336
1329
-- it here to avoid having to pass it on call-sites. It's not great
@@ -1341,13 +1334,13 @@ legacyProjectConfigFieldDescrs :: ConstraintSource -> [FieldDescr LegacyProjectC
1341
1334
legacyProjectConfigFieldDescrs constraintSrc =
1342
1335
[ newLineListField
1343
1336
" packages"
1344
- (Disp. text . renderPackageLocationToken)
1337
+ (text . renderPackageLocationToken)
1345
1338
parsePackageLocationTokenQ
1346
1339
legacyPackages
1347
1340
(\ v flags -> flags{legacyPackages = v})
1348
1341
, newLineListField
1349
1342
" optional-packages"
1350
- (Disp. text . renderPackageLocationToken)
1343
+ (text . renderPackageLocationToken)
1351
1344
parsePackageLocationTokenQ
1352
1345
legacyPackagesOptional
1353
1346
(\ v flags -> flags{legacyPackagesOptional = v})
@@ -1458,7 +1451,7 @@ legacySharedConfigFieldDescrs constraintSrc =
1458
1451
. addFields
1459
1452
[ commaNewLineListFieldParsec
1460
1453
" package-dbs"
1461
- (Disp. text . showPackageDb)
1454
+ (text . showPackageDb)
1462
1455
(fmap readPackageDb parsecToken)
1463
1456
configPackageDBs
1464
1457
(\ v conf -> conf{configPackageDBs = v})
@@ -1751,8 +1744,8 @@ legacyPackageConfigFieldDescrs =
1751
1744
in FieldDescr
1752
1745
name
1753
1746
( \ f -> case f of
1754
- Flag NoDumpBuildInfo -> Disp. text " False"
1755
- Flag DumpBuildInfo -> Disp. text " True"
1747
+ Flag NoDumpBuildInfo -> text " False"
1748
+ Flag DumpBuildInfo -> text " True"
1756
1749
_ -> Disp. empty
1757
1750
)
1758
1751
( \ line str _ -> case () of
@@ -1779,9 +1772,9 @@ legacyPackageConfigFieldDescrs =
1779
1772
in FieldDescr
1780
1773
name
1781
1774
( \ f -> case f of
1782
- Flag NoOptimisation -> Disp. text " False"
1783
- Flag NormalOptimisation -> Disp. text " True"
1784
- Flag MaximumOptimisation -> Disp. text " 2"
1775
+ Flag NoOptimisation -> text " False"
1776
+ Flag NormalOptimisation -> text " True"
1777
+ Flag MaximumOptimisation -> text " 2"
1785
1778
_ -> Disp. empty
1786
1779
)
1787
1780
( \ line str _ -> case () of
@@ -1804,10 +1797,10 @@ legacyPackageConfigFieldDescrs =
1804
1797
in FieldDescr
1805
1798
name
1806
1799
( \ f -> case f of
1807
- Flag NoDebugInfo -> Disp. text " False"
1808
- Flag MinimalDebugInfo -> Disp. text " 1"
1809
- Flag NormalDebugInfo -> Disp. text " True"
1810
- Flag MaximalDebugInfo -> Disp. text " 3"
1800
+ Flag NoDebugInfo -> text " False"
1801
+ Flag MinimalDebugInfo -> text " 1"
1802
+ Flag NormalDebugInfo -> text " True"
1803
+ Flag MaximalDebugInfo -> text " 3"
1811
1804
_ -> Disp. empty
1812
1805
)
1813
1806
( \ line str _ -> case () of
@@ -2132,6 +2125,6 @@ monoidFieldParsec name showF readF get' set =
2132
2125
-- otherwise are special syntax.
2133
2126
showTokenQ :: String -> Doc
2134
2127
showTokenQ " " = Disp. empty
2135
- showTokenQ x@ (' -' : ' -' : _) = Disp. text (show x)
2136
- showTokenQ x@ (' .' : [] ) = Disp. text (show x)
2128
+ showTokenQ x@ (' -' : ' -' : _) = text (show x)
2129
+ showTokenQ x@ (' .' : [] ) = text (show x)
2137
2130
showTokenQ x = showToken x
0 commit comments