@@ -69,33 +69,6 @@ data LocateResult
6969 | LocateFoundReexport UnitId
7070 | LocateFoundFile UnitId NormalizedFilePath
7171
72- {-
73- -- | locate a module in the file system. Where we go from *daml to Haskell
74- locateModuleFile :: MonadIO m
75- => [(UnitId, [FilePath], S.Set ModuleName)]
76- -> [String]
77- -> (ModuleName -> NormalizedFilePath -> m (Maybe NormalizedFilePath))
78- -> Bool
79- -> ModuleName
80- -> m LocateResult
81- locateModuleFile import_dirss exts targetFor isSource modName = do
82- let candidates import_dirs =
83- [ toNormalizedFilePath' (prefix </> moduleNameSlashes modName <.> maybeBoot ext)
84- | prefix <- import_dirs , ext <- exts]
85- mf <- firstJustM go (concat [map (uid,) (candidates dirs) | (uid, dirs, _) <- import_dirss])
86- case mf of
87- Nothing ->
88- case find (\(_ , _, reexports) -> S.member modName reexports) import_dirss of
89- Just (uid,_,_) -> pure $ LocateFoundReexport uid
90- Nothing -> pure LocateNotFound
91- Just (uid,file) -> pure $ LocateFoundFile uid file
92- where
93- go (uid, candidate) = fmap ((uid,) <$>) $ targetFor modName candidate
94- maybeBoot ext
95- | isSource = ext ++ "-boot"
96- | otherwise = ext
97- -}
98-
9972-- | This function is used to map a package name to a set of import paths.
10073-- It only returns Just for unit-ids which are possible to import into the
10174-- current module. In particular, it will return Nothing for 'main' components
@@ -143,6 +116,15 @@ locateModule moduleMaps@(moduleMap, moduleMapSource) env comp_info exts modName
143116 -- - TODO: should we look for file existence now? If the file was
144117 -- removed from the disk, how will it behaves? How do we invalidate
145118 -- that?
119+ --
120+ -- [About The reexported module]
121+ --
122+ -- A package (or unit) A can reexport a module from another package/unit.
123+ --
124+ -- When it happen, it means two things:
125+ --
126+ -- - This module must appear in 'moduleMaps', using the correct package/unit
127+ -- - What about "conflict". Right now the moduleMaps maps a module name to a unique package/unit.
146128 let mbFile = case Map. lookup (unLoc modName) (if isSource then moduleMapSource else moduleMap) of
147129 Nothing -> LocateNotFound
148130 Just (uid, file) -> LocateFoundFile uid file
0 commit comments