From 914ccdce1b9923f7fc8f75b3bdb188192291ac9b Mon Sep 17 00:00:00 2001 From: panne Date: Sat, 15 Jan 2005 18:44:48 +0000 Subject: [haddock @ 2005-01-15 18:44:45 by panne] Make Haddock compile again after the recent base package changed. The Map/Set legacy hell has been factored out, so that all modules can simply use the new non-deprecated interfaces. Probably a lot of things can be improved by a little bit of Map/Set/List algebra, this can be done later if needed. Small note: Currently the list of instances in HTML code is reversed. This will hopefully be fixed later. --- src/HaddockHtml.hs | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'src/HaddockHtml.hs') diff --git a/src/HaddockHtml.hs b/src/HaddockHtml.hs index 07c33bee..528dc47b 100644 --- a/src/HaddockHtml.hs +++ b/src/HaddockHtml.hs @@ -19,6 +19,8 @@ import HaddockHH import HaddockHH2 import HaddockDevHelp import HsSyn +import Map ( Map ) +import qualified Map import Maybe ( fromJust, isJust, mapMaybe ) import List ( sortBy ) @@ -32,12 +34,6 @@ import Control.Exception ( handle, bracket ) import Binary ( openBinaryFile ) import System.IO ( IOMode(..), hClose, hGetBuf, hPutBuf ) -#if __GLASGOW_HASKELL__ < 503 -import FiniteMap -#else -import Data.FiniteMap -#endif - import Html import qualified Html @@ -381,26 +377,26 @@ ppHtmlIndex odir doctitle maybe_package maybe_html_help_format maybe_contents_ur index_part = [(n,stuff) | (n,stuff) <- this_ix, toUpper (head n) == c] - index :: [(String, FiniteMap HsQName [(Module,Bool)])] - index = sortBy cmp (fmToList full_index) + index :: [(String, Map HsQName [(Module,Bool)])] + index = sortBy cmp (Map.toAscList full_index) where cmp (n1,_) (n2,_) = n1 `compare` n2 -- for each name (a plain string), we have a number of original HsNames that -- it can refer to, and for each of those we have a list of modules -- that export that entity. Each of the modules exports the entity -- in a visible or invisible way (hence the Bool). - full_index :: FiniteMap String (FiniteMap HsQName [(Module,Bool)]) - full_index = addListToFM_C (plusFM_C (++)) emptyFM + full_index :: Map String (Map HsQName [(Module,Bool)]) + full_index = Map.fromListWith (\l r -> Map.unionWith (++) r l) (concat (map getIfaceIndex ifaces)) getIfaceIndex (mdl,iface) = [ (hsNameStr nm, - listToFM [(orig, [(mdl, not (nm `elemFM` iface_reexported iface))])]) - | (nm, orig) <- fmToList (iface_env iface) ] + Map.fromList [(orig, [(mdl, not (nm `Map.member` iface_reexported iface))])]) + | (nm, orig) <- Map.toAscList (iface_env iface) ] - indexElt :: (String, FiniteMap HsQName [(Module,Bool)]) -> HtmlTable + indexElt :: (String, Map HsQName [(Module,Bool)]) -> HtmlTable indexElt (str, entities) = - case fmToList entities of + case Map.toAscList entities of [(nm,entries)] -> tda [ theclass "indexentry" ] << toHtml str <-> indexLinks (unQual nm) entries -- cgit v1.2.3