Add {-# OPTIONS_GHC -w #-} and some blurb to all compiler modules
[ghc-hetmet.git] / compiler / rename / RnHsDoc.hs
index 6941da5..e754a74 100644 (file)
@@ -1,17 +1,36 @@
-module RnHsDoc ( rnHsDoc, rnLHsDoc, rnMbLHsDoc, rnMbHsDoc ) where
+{-# OPTIONS_GHC -w #-}
+-- The above warning supression flag is a temporary kludge.
+-- While working on this module you are encouraged to remove it and fix
+-- any warnings in the module. See
+--     http://hackage.haskell.org/trac/ghc/wiki/WorkingConventions#Warnings
+-- for details
 
+module RnHsDoc ( rnHaddock, rnHsDoc, rnLHsDoc, rnMbLHsDoc ) where
+
+import TcRnTypes
 import TcRnMonad   ( RnM )
-import RnEnv       ( dataTcOccs, lookupGreRn )
-import HsDoc       ( HsDoc(..) )
+import RnEnv       ( dataTcOccs, lookupGreRn_maybe )
+import HsSyn
 
-import RdrName     ( RdrName, isRdrDataCon, isRdrTc, gre_name )
+import RdrName     ( RdrName, gre_name )
 import Name        ( Name )
 import SrcLoc      ( Located(..) )
 import Outputable  ( ppr, defaultUserStyle )
 
-import Data.List   ( (\\) )
-import Debug.Trace ( trace )
 
+rnHaddock :: HaddockModInfo RdrName -> Maybe (HsDoc RdrName)
+         -> TcGblEnv -> RnM TcGblEnv
+rnHaddock module_info maybe_doc tcg_env
+  = do { rn_module_doc <- rnMbHsDoc maybe_doc ;
+
+               -- Rename the Haddock module info 
+       ; rn_description <- rnMbHsDoc (hmi_description module_info)
+       ; let { rn_module_info = module_info { hmi_description = rn_description } }
+
+       ; return (tcg_env { tcg_doc = rn_module_doc, 
+                           tcg_hmi = rn_module_info }) }
+
+rnMbHsDoc :: Maybe (HsDoc RdrName) -> RnM (Maybe (HsDoc Name))
 rnMbHsDoc mb_doc = case mb_doc of
   Just doc -> do
     doc' <- rnHsDoc doc
@@ -49,7 +68,7 @@ rnHsDoc doc = case doc of
 
   DocIdentifier ids -> do
     let choices = concatMap dataTcOccs ids
-    mb_gres <- mapM lookupGreRn choices 
+    mb_gres <- mapM lookupGreRn_maybe choices 
     case [gre_name gre | Just gre <- mb_gres] of
       [] -> return (DocString (ids2string ids))
       ids' -> return (DocIdentifier ids')