@@ -127,7 +127,6 @@ import Distribution.Simple.Setup
127
127
import Distribution.Simple.Utils
128
128
( debug
129
129
, lowercase
130
- , ordNub
131
130
)
132
131
import Distribution.Types.CondTree
133
132
( CondBranch (.. )
@@ -139,7 +138,8 @@ import Distribution.Types.CondTree
139
138
)
140
139
import Distribution.Types.SourceRepo (RepoType )
141
140
import Distribution.Utils.NubList
142
- ( fromNubList
141
+ ( NubList
142
+ , fromNubList
143
143
, overNubList
144
144
, toNubList
145
145
)
@@ -249,14 +249,14 @@ parseProject rootPath cacheDir httpTransport verbosity configToParse = do
249
249
let (dir, projectFileName) = splitFileName rootPath
250
250
projectDir <- makeAbsolute dir
251
251
projectPath@ (ProjectConfigPath (canonicalRoot :| _)) <- canonicalizeConfigPath projectDir (ProjectConfigPath $ projectFileName :| [] )
252
- importsBy <- newIORef [(canonicalRoot, projectPath)]
252
+ importsBy <- newIORef $ toNubList [(canonicalRoot, projectPath)]
253
253
parseProjectSkeleton cacheDir httpTransport verbosity importsBy projectDir projectPath configToParse
254
254
255
255
parseProjectSkeleton
256
256
:: FilePath
257
257
-> HttpTransport
258
258
-> Verbosity
259
- -> IORef [( FilePath , ProjectConfigPath )]
259
+ -> IORef ( NubList ( FilePath , ProjectConfigPath ))
260
260
-- ^ The imports seen so far, used to report on cycles and duplicates and to detect duplicates that are not cycles
261
261
-> FilePath
262
262
-- ^ The directory of the project configuration, typically the directory of cabal.project
@@ -275,11 +275,11 @@ parseProjectSkeleton cacheDir httpTransport verbosity importsBy projectDir sourc
275
275
276
276
-- Once we canonicalize the import path, we can check for cyclical and duplicate imports
277
277
normLocPath@ (ProjectConfigPath (uniqueImport :| _)) <- canonicalizeConfigPath projectDir importLocPath
278
- seenImportsBy@ (fmap fst -> seenImports) <- atomicModifyIORef' importsBy (\ ibs -> (ordNub $ (uniqueImport, normLocPath) : ibs, ibs))
278
+ seenImportsBy@ (fmap fst -> seenImports) <- fromNubList <$> atomicModifyIORef' importsBy (\ ibs -> (toNubList [ (uniqueImport, normLocPath)] <> ibs, ibs))
279
279
280
280
debug verbosity $ " \n import path, normalized\n =======================\n " ++ render (docProjectConfigPath normLocPath)
281
281
debug verbosity " \n seen unique paths\n ================="
282
- mapM_ (debug verbosity . fst ) seenImportsBy
282
+ mapM_ (debug verbosity) seenImports
283
283
debug verbosity " \n "
284
284
285
285
if
0 commit comments