diff options
Diffstat (limited to 'src/Haddock/GhcUtils.hs')
-rw-r--r-- | src/Haddock/GhcUtils.hs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/Haddock/GhcUtils.hs b/src/Haddock/GhcUtils.hs index e0202ed6..62b370bb 100644 --- a/src/Haddock/GhcUtils.hs +++ b/src/Haddock/GhcUtils.hs @@ -23,12 +23,14 @@ import Control.Arrow import Data.Foldable hiding (concatMap) import Data.Traversable -import HsSyn -import SrcLoc import Outputable import Name import Packages import Module +import RdrName (GlobalRdrEnv) +import HscTypes +import LazyUniqFM +import GHC moduleString :: Module -> String @@ -56,6 +58,13 @@ mkModuleNoPackage :: String -> Module mkModuleNoPackage str = mkModule (stringToPackageId "") (mkModuleName str) +lookupLoadedHomeModuleGRE :: GhcMonad m => ModuleName -> m (Maybe GlobalRdrEnv) +lookupLoadedHomeModuleGRE mod_name = withSession $ \hsc_env -> + case lookupUFM (hsc_HPT hsc_env) mod_name of + Just mod_info -> return (mi_globals (hm_iface mod_info)) + _not_a_home_module -> return Nothing + + instance (Outputable a, Outputable b) => Outputable (Map.Map a b) where ppr m = ppr (Map.toList m) |