@@ -18,6 +18,8 @@ import Control.Exception (evaluate, mask, throwIO)
1818import Control.Monad.Extra (eitherM , join , mapMaybeM )
1919import Control.Monad.IO.Class
2020import Data.Either (fromRight )
21+ import Data.Set (Set )
22+ import qualified Data.Set as Set
2123import Data.Unique
2224import Development.IDE.GHC.Compat
2325import Development.IDE.GHC.Error (catchSrcErrors )
@@ -48,7 +50,7 @@ data HscEnvEq = HscEnvEq
4850 -- ^ In memory components for this HscEnv
4951 -- This is only used at the moment for the import dirs in
5052 -- the DynFlags
51- , envImportPaths :: Maybe [ String ]
53+ , envImportPaths :: Maybe ( Set FilePath )
5254 -- ^ If Just, import dirs originally configured in this env
5355 -- If Nothing, the env import dirs are unaltered
5456 , envPackageExports :: IO ExportsMap
@@ -69,9 +71,9 @@ newHscEnvEq cradlePath hscEnv0 deps = do
6971 importPathsCanon <-
7072 mapM canonicalizePath $ relativeToCradle <$> importPaths (hsc_dflags hscEnv0)
7173
72- newHscEnvEqWithImportPaths (Just importPathsCanon) hscEnv deps
74+ newHscEnvEqWithImportPaths (Just $ Set. fromList importPathsCanon) hscEnv deps
7375
74- newHscEnvEqWithImportPaths :: Maybe [ String ] -> HscEnv -> [(InstalledUnitId , DynFlags )] -> IO HscEnvEq
76+ newHscEnvEqWithImportPaths :: Maybe ( Set FilePath ) -> HscEnv -> [(InstalledUnitId , DynFlags )] -> IO HscEnvEq
7577newHscEnvEqWithImportPaths envImportPaths hscEnv deps = do
7678
7779 let dflags = hsc_dflags hscEnv
@@ -121,7 +123,7 @@ newHscEnvEqPreserveImportPaths = newHscEnvEqWithImportPaths Nothing
121123hscEnvWithImportPaths :: HscEnvEq -> HscEnv
122124hscEnvWithImportPaths HscEnvEq {.. }
123125 | Just imps <- envImportPaths
124- = hscEnv{hsc_dflags = (hsc_dflags hscEnv){importPaths = imps}}
126+ = hscEnv{hsc_dflags = (hsc_dflags hscEnv){importPaths = Set. toList imps}}
125127 | otherwise
126128 = hscEnv
127129
0 commit comments