diff options
author | Ćukasz Hanuszczak <lukasz.hanuszczak@gmail.com> | 2015-07-28 23:58:13 +0200 |
---|---|---|
committer | Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> | 2015-08-21 18:22:32 +0100 |
commit | 88df578a8573908d665d4597c4c619c29055a277 (patch) | |
tree | 201a057cebaae47199264d4ebd7d7e6b62295b9c /haddock-api/src/Haddock | |
parent | f0a5efd72072b37a2150efd281eb158033e67585 (diff) |
Rearrange layout of instance methods in generated documentation.
Diffstat (limited to 'haddock-api/src/Haddock')
-rw-r--r-- | haddock-api/src/Haddock/Backends/Xhtml/Decl.hs | 39 | ||||
-rw-r--r-- | haddock-api/src/Haddock/Backends/Xhtml/Layout.hs | 2 |
2 files changed, 27 insertions, 14 deletions
diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs index a9f38c14..abcf3eaf 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs @@ -525,26 +525,39 @@ ppInstances links origin instances baseName splice unicode qual where instName = getOccString $ getName baseName instDecl :: Int -> DocInstance DocName -> (SubDecl,Located DocName) - instDecl no (inst, maybeDoc,l) = - ((ppInstHead links splice unicode qual origin no inst, maybeDoc, []),l) + instDecl no (inst, mdoc, loc) = + ((ppInstHead links splice unicode qual mdoc origin no inst), loc) ppInstHead :: LinksInfo -> Splice -> Unicode -> Qualification - -> InstOrigin -> Int -> InstHead DocName - -> Html -ppInstHead links splice unicode qual origin no (InstHead {..}) = + -> Maybe (MDoc DocName) -> InstOrigin -> Int -> InstHead DocName + -> SubDecl +ppInstHead links splice unicode qual mdoc origin no (InstHead {..}) = case ihdInstType of ClassInst { .. } -> - subClsInstance iid hdr mets + ( subInstHead iid $ ppContextNoLocs clsiCtx unicode qual <+> typ + , mdoc + , [subInstMethods iid sigs] + ) where - hdr = ppContextNoLocs clsiCtx unicode qual <+> typ - mets = ppInstanceSigs links splice unicode qual - clsiTyVars ihdTypes clsiSigs iid = instanceId origin no ihdClsName - TypeInst rhs -> keyword "type" <+> typ - <+> maybe noHtml (\t -> equals <+> ppType unicode qual t) rhs - DataInst dd -> keyword "data" <+> typ - <+> ppShortDataDecl False True dd unicode qual + sigs = ppInstanceSigs links splice unicode qual + clsiTyVars ihdTypes clsiSigs + TypeInst rhs -> + (ptype, mdoc, []) + where + ptype = mconcat + [ keyword "type" + , typ + , maybe noHtml (\t -> equals <+> ppType unicode qual t) rhs + ] + DataInst dd -> + (pdata, mdoc, []) + where + pdata = mconcat + [ keyword "data" <+> typ + , ppShortDataDecl False True dd unicode qual + ] where typ = ppAppNameTypes ihdClsName ihdKinds ihdTypes unicode qual diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs b/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs index da03985e..0b09e220 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs @@ -31,7 +31,7 @@ module Haddock.Backends.Xhtml.Layout ( subConstructors, subEquations, subFields, - subInstances, subClsInstance, + subInstances, subClsInstance, subInstHead, subInstMethods, subMethods, subMinimal, |