diff options
author | Isaac Dupree <id@isaac.cedarswampstudios.org> | 2009-08-23 06:26:36 +0000 |
---|---|---|
committer | Isaac Dupree <id@isaac.cedarswampstudios.org> | 2009-08-23 06:26:36 +0000 |
commit | 3a51468aabab2a3f4b9e06e7e0025f2421e07469 (patch) | |
tree | 0b3cd5e8096900b5855e8bf77b522bf4d3bfb027 /src/Haddock/Interface/Rename.hs | |
parent | 708bfb537b377129ea81025efbef3f6270fb827f (diff) |
re-implement function-argument docs
..on top of the lexParseRn work.
This patch doesn't change the InstalledInterface format, and thus,
it does not work cross-package, but that will be easy to add
subsequently.
Diffstat (limited to 'src/Haddock/Interface/Rename.hs')
-rw-r--r-- | src/Haddock/Interface/Rename.hs | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/Haddock/Interface/Rename.hs b/src/Haddock/Interface/Rename.hs index b377b4fb..0caf79ba 100644 --- a/src/Haddock/Interface/Rename.hs +++ b/src/Haddock/Interface/Rename.hs @@ -38,8 +38,8 @@ renameInterface renamingEnv warnings iface = where fn env name = Map.insert name (ifaceMod iface) env docMap = Map.map (\(_,x,_) -> x) (ifaceDeclMap iface) - docs = [ (n, doc) | (n, Just doc) <- Map.toList docMap ] - renameMapElem (k,d) = do d' <- renameDoc d; return (k, d') + docs = Map.toList docMap + renameMapElem (k,d) = do d' <- renameDocForDecl d; return (k, d') -- rename names in the exported declarations to point to things that -- are closer to, or maybe even exported by, the current module. @@ -141,6 +141,13 @@ renameExportItems :: [ExportItem Name] -> RnM [ExportItem DocName] renameExportItems = mapM renameExportItem +renameDocForDecl :: (Maybe (HsDoc Name), FnArgsDoc Name) -> RnM (Maybe (HsDoc DocName), FnArgsDoc DocName) +renameDocForDecl (mbDoc, fnArgsDoc) = do + mbDoc' <- renameMaybeDoc mbDoc + fnArgsDoc' <- renameFnArgsDoc fnArgsDoc + return (mbDoc', fnArgsDoc') + + renameMaybeDoc :: Maybe (HsDoc Name) -> RnM (Maybe (HsDoc DocName)) renameMaybeDoc = mapM renameDoc @@ -199,6 +206,10 @@ renameDoc d = case d of DocAName str -> return (DocAName str) +renameFnArgsDoc :: FnArgsDoc Name -> RnM (FnArgsDoc DocName) +renameFnArgsDoc = mapM renameDoc + + renameLPred :: LHsPred Name -> RnM (LHsPred DocName) renameLPred = mapM renamePred @@ -434,7 +445,7 @@ renameExportItem item = case item of return (ExportGroup lev id_ doc') ExportDecl decl doc subs instances -> do decl' <- renameLDecl decl - doc' <- mapM renameDoc doc + doc' <- renameDocForDecl doc subs' <- mapM renameSub subs instances' <- mapM renameInstHead instances return (ExportDecl decl' doc' subs' instances') @@ -447,8 +458,8 @@ renameExportItem item = case item of return (ExportDoc doc') -renameSub :: (Name, Maybe (HsDoc Name)) -> RnM (DocName, Maybe (HsDoc DocName)) +renameSub :: (Name, DocForDecl Name) -> RnM (DocName, DocForDecl DocName) renameSub (n,doc) = do n' <- rename n - doc' <- mapM renameDoc doc + doc' <- renameDocForDecl doc return (n', doc') |