- getModuleHiMap `thenRn` \ himap ->
- case (lookupFM himap real_mod_name) of
- Nothing ->
- traceRn (ptext SLIT("...failed")) `thenRn_`
- returnRn Nothing
- Just fpath ->
- readIface fpath
-{-
- getSearchPathRn `thenRn` \ dirs ->
- try dirs
--}
+ -- we keep two maps for interface files,
+ -- one for 'normal' ones, the other for .hi-boot files,
+ -- hence the need to signal which kind we're interested.
+ getModuleHiMap as_source `thenRn` \ himap ->
+ case (lookupFM himap (moduleString mod_name)) of
+ -- Found the file
+ Just fpath -> readIface fpath
+ -- Hack alert! When compiling PrelBase we have to load the
+ -- decls for packCString# and friends; they are 'thin-air' Ids
+ -- (see PrelInfo.lhs). So if we don't find the HiFile we quietly
+ -- look for a .hi-boot file instead, and use that
+ Nothing | thinAirLoop mod_name as_source
+ -> findAndReadIface doc_str mod_name HiBootFile
+ | otherwise
+ -> traceRn (ptext SLIT("...failed")) `thenRn_`
+ returnRn Nothing