diff options
author | David Waern <unknown> | 2007-08-29 23:26:24 +0000 |
---|---|---|
committer | David Waern <unknown> | 2007-08-29 23:26:24 +0000 |
commit | 2ad606aaea58bce57ebb1681831514caf6ff56a3 (patch) | |
tree | a0f86d267a922efa5dc8929074934e5d605a86b5 /src/Haddock/Interface.hs | |
parent | 658e79eddf0ac941d2719ec0a3aea58f42ef1277 (diff) |
Rename HaddockModule to Interface and a few more refactorings
Diffstat (limited to 'src/Haddock/Interface.hs')
-rw-r--r-- | src/Haddock/Interface.hs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/Haddock/Interface.hs b/src/Haddock/Interface.hs index aed4af34..41a73480 100644 --- a/src/Haddock/Interface.hs +++ b/src/Haddock/Interface.hs @@ -2,10 +2,10 @@ -- Haddock.Interface -- -- Here we build the actual module interfaces. By interface we mean the --- information which is used to render a Haddock page for a module. Parts of +-- information that is used to render a Haddock page for a module. Parts of -- this information is also stored in the interface files. -- --- The HaddockModule structure holds the interface data as well as +-- The Interface structure holds the interface data as well as -- intermediate information needed during its creation. ------------------------------------------------------------------------------- @@ -35,7 +35,7 @@ import Name -- return the home link environment created in the process, and any error -- messages. createInterfaces :: [GhcModule] -> LinkEnv -> [Flag] -> - ([HaddockModule], LinkEnv, [ErrMsg]) + ([Interface], LinkEnv, [ErrMsg]) createInterfaces modules extLinks flags = (interfaces, homeLinks, messages) where ((interfaces, homeLinks), messages) = runWriter $ do @@ -47,7 +47,7 @@ createInterfaces modules extLinks flags = (interfaces, homeLinks, messages) renameInterfaces interfaces' extLinks -createInterfaces' :: [GhcModule] -> [Flag] -> ErrMsgM [HaddockModule] +createInterfaces' :: [GhcModule] -> [Flag] -> ErrMsgM [Interface] createInterfaces' modules flags = do resultMap <- foldM addInterface Map.empty modules return (Map.elems resultMap) @@ -58,14 +58,15 @@ createInterfaces' modules flags = do return $ Map.insert (hmod_mod interface) interface map -renameInterfaces :: [HaddockModule] -> LinkEnv -> - ErrMsgM ([HaddockModule], LinkEnv) +renameInterfaces :: [Interface] -> LinkEnv -> + ErrMsgM ([Interface], LinkEnv) renameInterfaces interfaces externalLinks = do let homeLinks = buildHomeLinks interfaces let links = homeLinks `Map.union` externalLinks interfaces' <- mapM (renameInterface links) interfaces return (interfaces', homeLinks) + -- | Build a mapping which for each original name, points to the "best" -- place to link to in the documentation. For the definition of -- "best", we use "the module nearest the bottom of the dependency @@ -74,7 +75,7 @@ renameInterfaces interfaces externalLinks = do -- -- The interfaces are passed in in topologically sorted order, but we start -- by reversing the list so we can do a foldl. -buildHomeLinks :: [HaddockModule] -> LinkEnv +buildHomeLinks :: [Interface] -> LinkEnv buildHomeLinks modules = foldl upd Map.empty (reverse modules) where upd old_env mod |