@@ -18,6 +18,8 @@ import Control.Exception (evaluate, mask, throwIO)
18
18
import Control.Monad.Extra (eitherM , join , mapMaybeM )
19
19
import Control.Monad.IO.Class
20
20
import Data.Either (fromRight )
21
+ import Data.Set (Set )
22
+ import qualified Data.Set as Set
21
23
import Data.Unique
22
24
import Development.IDE.GHC.Compat
23
25
import Development.IDE.GHC.Error (catchSrcErrors )
@@ -48,7 +50,7 @@ data HscEnvEq = HscEnvEq
48
50
-- ^ In memory components for this HscEnv
49
51
-- This is only used at the moment for the import dirs in
50
52
-- the DynFlags
51
- , envImportPaths :: Maybe [ String ]
53
+ , envImportPaths :: Maybe ( Set FilePath )
52
54
-- ^ If Just, import dirs originally configured in this env
53
55
-- If Nothing, the env import dirs are unaltered
54
56
, envPackageExports :: IO ExportsMap
@@ -69,9 +71,9 @@ newHscEnvEq cradlePath hscEnv0 deps = do
69
71
importPathsCanon <-
70
72
mapM canonicalizePath $ relativeToCradle <$> importPaths (hsc_dflags hscEnv0)
71
73
72
- newHscEnvEqWithImportPaths (Just importPathsCanon) hscEnv deps
74
+ newHscEnvEqWithImportPaths (Just $ Set. fromList importPathsCanon) hscEnv deps
73
75
74
- newHscEnvEqWithImportPaths :: Maybe [ String ] -> HscEnv -> [(InstalledUnitId , DynFlags )] -> IO HscEnvEq
76
+ newHscEnvEqWithImportPaths :: Maybe ( Set FilePath ) -> HscEnv -> [(InstalledUnitId , DynFlags )] -> IO HscEnvEq
75
77
newHscEnvEqWithImportPaths envImportPaths hscEnv deps = do
76
78
77
79
let dflags = hsc_dflags hscEnv
@@ -121,7 +123,7 @@ newHscEnvEqPreserveImportPaths = newHscEnvEqWithImportPaths Nothing
121
123
hscEnvWithImportPaths :: HscEnvEq -> HscEnv
122
124
hscEnvWithImportPaths HscEnvEq {.. }
123
125
| Just imps <- envImportPaths
124
- = hscEnv{hsc_dflags = (hsc_dflags hscEnv){importPaths = imps}}
126
+ = hscEnv{hsc_dflags = (hsc_dflags hscEnv){importPaths = Set. toList imps}}
125
127
| otherwise
126
128
= hscEnv
127
129
0 commit comments