remove Haddock-lexing/parsing/renaming from GHC
[ghc-hetmet.git] / compiler / rename / RnHsDoc.hs
1
2 module RnHsDoc ( rnHsDoc, rnLHsDoc, rnMbLHsDoc ) where
3
4 import TcRnTypes
5 import RnEnv       ( dataTcOccs, lookupGreRn_maybe )
6 import HsSyn
7
8 import RdrName     ( RdrName, gre_name )
9 import Name        ( Name )
10 import SrcLoc      ( Located(..) )
11 import Outputable  ( ppr, defaultUserStyle )
12
13
14 rnMbHsDoc :: Maybe HsDocString -> RnM (Maybe HsDocString)
15 rnMbHsDoc mb_doc = case mb_doc of
16   Just doc -> do
17     doc' <- rnHsDoc doc
18     return (Just doc')
19   Nothing -> return Nothing
20
21 rnMbLHsDoc :: Maybe LHsDocString -> RnM (Maybe LHsDocString)
22 rnMbLHsDoc mb_doc = case mb_doc of
23   Just doc -> do
24     doc' <- rnLHsDoc doc
25     return (Just doc')
26   Nothing -> return Nothing
27
28 rnLHsDoc :: LHsDocString -> RnM LHsDocString
29 rnLHsDoc (L pos doc) = do
30   doc' <- rnHsDoc doc
31   return (L pos doc')
32
33 ids2string :: [RdrName] -> String
34 ids2string []    = []
35 ids2string (x:_) = show $ ppr x defaultUserStyle
36
37 rnHsDoc :: HsDocString -> RnM HsDocString
38 rnHsDoc (HsDocString s) = return (HsDocString s)
39