From fe2a7afdfcceb85e4678eaa4ab54b51a9e890c68 Mon Sep 17 00:00:00 2001 From: David Waern Date: Sun, 13 Jul 2008 13:09:16 +0000 Subject: Refactoring in H.Interface.Create We were creating a doc map, a declaration map and a list of entities separately by going through the HsGroup. These structures were all used to build the interface of a module. Instead of doing this, we can start by creating a list of declarations from the HsGroup, then collect the docs directly from this list (instead of using the list of entities), creating a documentation map. We no longer need the Entity data type, and we can store a single map from names to declarations and docs in the interface, instead of the declaration map and the doc map. This way, there is only one place where we filter out the declarations that we don't want, and we can remove a lot of code. Another advantage of this is that we can create the exports directly out of the list of declarations when we export the full module contents. (Previously we did a look up for each name to find the declarations). This is faster and removes another point where we depend on names to identify exported declarations, which is good because it eliminates problems with instances (which don't have names). --- src/Haddock/Types.hs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/Haddock/Types.hs') diff --git a/src/Haddock/Types.hs b/src/Haddock/Types.hs index 38d56b49..e91f28cc 100644 --- a/src/Haddock/Types.hs +++ b/src/Haddock/Types.hs @@ -130,8 +130,7 @@ data Interface = Interface { -- | The Haddock options for this module (prune, ignore-exports, etc) ifaceOptions :: [DocOption], - ifaceDeclMap :: Map Name (LHsDecl Name), - ifaceDocMap :: Map Name (HsDoc Name), + ifaceDeclMap :: Map Name (LHsDecl Name, Maybe (HsDoc Name)), ifaceRnDocMap :: Map Name (HsDoc DocName), ifaceExportItems :: [ExportItem Name], -- cgit v1.2.3