+makeHiMap :: Maybe String -> IO (FiniteMap Module FilePath)
+
+makeHiMap Nothing = error "Rename.makeHiMap:no .hi map given by the GHC driver (?)"
+makeHiMap (Just f)
+ = readFile f >>= \ cts ->
+ return (snag_mod emptyFM cts [])
+ where
+ -- we alternate between "snag"ging mod(ule names) and path(names),
+ -- accumulating names (reversed) and the final resulting map
+ -- as we move along.
+
+ snag_mod map [] [] = map
+ snag_mod map (' ':cs) rmod = snag_path map (_PK_ (reverse rmod)) cs []
+ snag_mod map (c:cs) rmod = snag_mod map cs (c:rmod)
+
+ snag_path map mod [] rpath = addToFM map mod (reverse rpath)
+ snag_path map mod ('\n':cs) rpath = snag_mod (addToFM map mod (reverse rpath)) cs []
+ snag_path map mod (c:cs) rpath = snag_path map mod cs (c:rpath)
+\end{code}
+
+\begin{code}