@@ -77,10 +77,19 @@ generateDocs ist nss' out =
7777
7878-- ----------------------------------------------------------------- [ Types ]
7979
80+-- | Either an error message or a result
8081type Failable = Either String
82+
83+-- | Internal representation of a fully qualified namespace name
8184type NsName = [T.Text]
85+
86+-- | All information to be documented about a single namespace member
8287type NsItem = (Name, Maybe Docs, Accessibility)
88+
89+-- | All information to be documented about a namespace
8390type NsInfo = [NsItem]
91+
92+-- | A map from namespace names to information about them
8493type NsDict = M.Map NsName NsInfo
8594
8695-- --------------------------------------------------------------- [ Utility ]
@@ -133,10 +142,11 @@ fetchInfo :: IState -- ^ IState to fetch info from
133142fetchInfo ist nss =
134143 do let originNss = S.fromList nss
135144 info <- nsDict ist
136− let info' = M.map (filter (filterName . (\(n, _, _) -> n))) info
145+ let info' = M.map (filter filterInclude) info
137146 info'' = M.map removeOrphans info'
138− reachedNss = traceNss info'' originNss S.empty
139− return $ M.filterWithKey (\k _ -> S.member k reachedNss) info''
147+ info''' = M.filter (not . null) info''
148+ reachedNss = traceNss info''' originNss S.empty
149+ return $ M.filterWithKey (\k _ -> S.member k reachedNss) info'''
140150
141151
142152-- | Removes loose class methods and data constructors,
@@ -160,6 +170,16 @@ filterName (NS n _) = filterName n
160170filterName _ = False
161171
162172
173+-- | Whether a NsItem should be included in the documentation.
174+-- It must not be Hidden and filterName must return True for the name.
175+-- Also it must have Docs -- without Docs, nothing can be done.
176+filterInclude :: NsItem -- ^ Accessibility to check
177+ -> Bool -- ^ Predicate result
178+filterInclude (name, Just _, Public) | filterName name = True
179+filterInclude (name, Just _, Frozen) | filterName name = True
180+filterInclude _ = False
181+
182+
163183-- | Finds all namespaces indirectly referred by a set of namespaces.
164184-- The NsItems of the namespaces are searched for references.
165185traceNss :: NsDict -- ^ Mappings of namespaces and their contents
@@ -215,7 +235,7 @@ getAccess ist n =
215235 let res = lookupDefAcc n False (tt_ctxt ist)
216236 in case res of
217237 [(_, acc)] -> acc
218− _ -> Public
238+ _ -> Hidden
219239
220240-- | Simple predicate for whether an NsItem has Docs
221241hasDoc :: NsItem -- ^ The NsItem to test
@@ -403,19 +423,15 @@ createNsDoc ist ns content out =
403423 do let tpath = out </> "docs" </> (genRelNsPath ns "html")
404424 dir = takeDirectory tpath
405425 file = takeFileName tpath
406− visible (_, _, Hidden) = False
407− visible _ = True
408426 haveDocs (_, Just d, _) = [d]
409427 haveDocs _ = []
410− -- Do not document private members
411− content' = filter visible content
412428 -- We cannot do anything without a Doc
413− content'' = concatMap haveDocs content'
429+ content' = concatMap haveDocs content
414430 createDirectoryIfMissing True dir
415431 (path, h) <- openTempFile dir file
416432 BS2.hPut h $ renderHtml $ wrapper (Just ns) $ do
417433 H.h1 $ toHtml (nsName2Str ns)
418− H.dl ! class_ "decls" $ forM_ content'' (createOtherDoc ist)
434+ H.dl ! class_ "decls" $ forM_ content' (createOtherDoc ist)
419435 hClose h
420436 renameFile path tpath
421437