@@ -89,6 +89,7 @@ import Distribution.Version (thisVersion)
89
89
import Distribution.Compat.Graph (IsNode (.. ))
90
90
91
91
import Control.Monad
92
+ import qualified Data.Set as Set
92
93
import qualified Data.ByteString.Lazy as LBS
93
94
import System.FilePath ( (</>) , (<.>) , takeDirectory )
94
95
import System.Directory ( getCurrentDirectory , removeFile , doesFileExist )
@@ -433,36 +434,52 @@ generateCode codeGens nm pdesc bi lbi clbi verbosity = do
433
434
-- information.
434
435
addExtraCSources :: BuildInfo -> [FilePath ] -> BuildInfo
435
436
addExtraCSources bi extras = bi { cSources = new }
436
- where new = ordNub (extras ++ cSources bi)
437
+ where new = Set. toList $ old `Set.union` exs
438
+ old = Set. fromList $ cSources bi
439
+ exs = Set. fromList extras
440
+
437
441
438
442
-- | Add extra C++ sources generated by preprocessing to build
439
443
-- information.
440
444
addExtraCxxSources :: BuildInfo -> [FilePath ] -> BuildInfo
441
445
addExtraCxxSources bi extras = bi { cxxSources = new }
442
- where new = ordNub (extras ++ cxxSources bi)
446
+ where new = Set. toList $ old `Set.union` exs
447
+ old = Set. fromList $ cxxSources bi
448
+ exs = Set. fromList extras
449
+
443
450
444
451
-- | Add extra C-- sources generated by preprocessing to build
445
452
-- information.
446
453
addExtraCmmSources :: BuildInfo -> [FilePath ] -> BuildInfo
447
454
addExtraCmmSources bi extras = bi { cmmSources = new }
448
- where new = ordNub (extras ++ cmmSources bi)
455
+ where new = Set. toList $ old `Set.union` exs
456
+ old = Set. fromList $ cmmSources bi
457
+ exs = Set. fromList extras
458
+
449
459
450
460
-- | Add extra ASM sources generated by preprocessing to build
451
461
-- information.
452
462
addExtraAsmSources :: BuildInfo -> [FilePath ] -> BuildInfo
453
463
addExtraAsmSources bi extras = bi { asmSources = new }
454
- where new = ordNub (extras ++ asmSources bi)
464
+ where new = Set. toList $ old `Set.union` exs
465
+ old = Set. fromList $ asmSources bi
466
+ exs = Set. fromList extras
455
467
456
468
-- | Add extra HS modules generated by preprocessing to build
457
469
-- information.
458
470
addExtraOtherModules :: BuildInfo -> [ModuleName. ModuleName ] -> BuildInfo
459
471
addExtraOtherModules bi extras = bi { otherModules = new }
460
- where new = ordNub (extras ++ otherModules bi)
472
+ where new = Set. toList $ old `Set.union` exs
473
+ old = Set. fromList $ otherModules bi
474
+ exs = Set. fromList extras
461
475
462
476
-- | Add extra source dir for generated modules.
463
477
addSrcDir :: BuildInfo -> FilePath -> BuildInfo
464
478
addSrcDir bi extra = bi { hsSourceDirs = new }
465
- where new = ordNub (unsafeMakeSymbolicPath extra : hsSourceDirs bi)
479
+ where new = Set. toList $ old `Set.union` ex
480
+ old = Set. fromList $ hsSourceDirs bi
481
+ ex = Set. fromList [unsafeMakeSymbolicPath extra] -- TODO
482
+
466
483
467
484
replComponent :: ReplOptions
468
485
-> Verbosity
0 commit comments