From dc62b95d18c61fc0bf7c8d4c49d23a240af32568 Mon Sep 17 00:00:00 2001 From: Ɓukasz Hanuszczak Date: Thu, 23 Jul 2015 19:27:24 +0200 Subject: Get rid of no longer neccessary instance specification type. --- haddock-api/src/Haddock/Backends/Xhtml/Decl.hs | 35 +++++++++++++------------- haddock-api/src/Haddock/Types.hs | 6 ----- 2 files changed, 17 insertions(+), 24 deletions(-) (limited to 'haddock-api/src') diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs index a894972e..34da4baa 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs @@ -282,7 +282,7 @@ ppTyFam summary associated links instances fixities loc doc decl splice unicode = subEquations qual $ map (ppTyFamEqn . unLoc) eqns | otherwise - = ppInstances links instances Nothing docname splice unicode qual + = ppInstances links instances docname splice unicode qual -- Individual equation of a closed type family ppTyFamEqn TyFamEqn { tfe_tycon = n, tfe_rhs = rhs @@ -506,38 +506,37 @@ ppClassDecl summary links instances fixities loc d subdocs ppMinimal p (Or fs) = wrap $ foldr1 (\a b -> a+++" | "+++b) $ map (ppMinimal False) fs where wrap | p = parens | otherwise = id - instSpec = Just $ InstSpec { ispecSigs = sigs, ispecTyVars = ltyvars } - instancesBit = ppInstances links instances instSpec nm splice unicode qual + instancesBit = ppInstances links instances nm splice unicode qual ppClassDecl _ _ _ _ _ _ _ _ _ _ _ = error "declaration type not supported by ppShortClassDecl" ppInstances :: LinksInfo - -> [DocInstance DocName] -> Maybe (InstSpec DocName) -> DocName + -> [DocInstance DocName] -> DocName -> Splice -> Unicode -> Qualification -> Html -ppInstances links instances mspec baseName splice unicode qual +ppInstances links instances baseName splice unicode qual = subInstances qual instName links True (zipWith instDecl [1..] instances) -- force Splice = True to use line URLs where instName = getOccString $ getName baseName instDecl :: Int -> DocInstance DocName -> (SubDecl,Located DocName) instDecl iid (inst, maybeDoc,l) = - ((ppInstHead links splice unicode qual iid mspec inst, maybeDoc, []),l) + ((ppInstHead links splice unicode qual iid inst, maybeDoc, []),l) ppInstHead :: LinksInfo -> Splice -> Unicode -> Qualification - -> Int -> Maybe (InstSpec DocName) -> InstHead DocName + -> Int -> InstHead DocName -> Html -ppInstHead links splice unicode qual iid mspec ihead@(InstHead {..}) = +ppInstHead links splice unicode qual iid (InstHead {..}) = case ihdInstType of - ClassInst cs _ _ | Just spec <- mspec -> - subClsInstance (nameStr ++ "-" ++ show iid) hdr (mets spec ihead) + ClassInst { .. } -> + subClsInstance (nameStr ++ "-" ++ show iid) hdr mets where - hdr = ppContextNoLocs cs unicode qual <+> typ + hdr = ppContextNoLocs clsiCtx unicode qual <+> typ mets = ppInstanceSigs links splice unicode qual + clsiTyVars ihdTypes clsiSigs nameStr = occNameString . nameOccName $ getName ihdClsName - ClassInst cs _ _ -> ppContextNoLocs cs unicode qual <+> typ TypeInst rhs -> keyword "type" <+> typ <+> maybe noHtml (\t -> equals <+> ppType unicode qual t) rhs DataInst dd -> keyword "data" <+> typ @@ -547,15 +546,15 @@ ppInstHead links splice unicode qual iid mspec ihead@(InstHead {..}) = ppInstanceSigs :: LinksInfo -> Splice -> Unicode -> Qualification - -> InstSpec DocName -> InstHead DocName + -> LHsTyVarBndrs DocName -> [HsType DocName] -> [Sig DocName] -> [Html] -ppInstanceSigs links splice unicode qual (InstSpec {..}) (InstHead {..}) = do - TypeSig lnames (L loc typ) _ <- ispecSigs +ppInstanceSigs links splice unicode qual bndrs tys sigs = do + TypeSig lnames (L loc typ) _ <- sigs let names = map unLoc lnames - let typ' = rename' . sugar $ specializeTyVarBndrs ispecTyVars ihdTypes typ + let typ' = rename' . sugar $ specializeTyVarBndrs bndrs tys typ return $ ppSimpleSig links splice unicode qual loc names typ' where - fv = foldr Set.union Set.empty . map freeVariables $ ihdTypes + fv = foldr Set.union Set.empty . map freeVariables $ tys rename' = rename fv @@ -628,7 +627,7 @@ ppDataDecl summary links instances fixities subdocs loc doc dataDecl (map unLoc (con_names (unLoc c)))) fixities ] - instancesBit = ppInstances links instances Nothing docname + instancesBit = ppInstances links instances docname splice unicode qual diff --git a/haddock-api/src/Haddock/Types.hs b/haddock-api/src/Haddock/Types.hs index 0c130cb1..b4a41020 100644 --- a/haddock-api/src/Haddock/Types.hs +++ b/haddock-api/src/Haddock/Types.hs @@ -352,12 +352,6 @@ data InstHead name = InstHead , ihdInstType :: InstType name } --- | Instance details used for printing specialized method signatures. -data InstSpec name = InstSpec - { ispecTyVars :: LHsTyVarBndrs name - , ispecSigs :: [Sig name] - } - ----------------------------------------------------------------------------- -- * Documentation comments ----------------------------------------------------------------------------- -- cgit v1.2.3