- case find_path from hi_maps of
- -- Found the file
- (hi_boot, Just (fpath, mod)) -> traceRn (ptext SLIT("...reading from") <+> text fpath)
- `thenRn_`
- readIface mod fpath `thenRn` \ result ->
- returnRn (hi_boot, result)
- (hi_boot, Nothing) -> traceRn (ptext SLIT("...not found")) `thenRn_`
- returnRn (hi_boot, Nothing)
- where
- find_path ImportByUser (hi_map, _) = (False, lookupFM hi_map mod_name)
- find_path ImportByUserSource (_, hiboot_map) = (True, lookupFM hiboot_map mod_name)
-
- find_path ImportBySystem (hi_map, hiboot_map)
- | hi_file
- = -- If the module we seek is in our dependent set,
- -- Look for a .hi file
- (False, lookupFM hi_map mod_name)
-
- | otherwise
- -- Check if there's a library module of that name
- -- If not, look for an hi-boot file
- = case lookupFM hi_map mod_name of
- stuff@(Just (_, mod)) | isLibModule mod -> (False, stuff)
- other -> (True, lookupFM hiboot_map mod_name)