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