aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/Backends/Hoogle.hs
diff options
context:
space:
mode:
authorAlec Theriault <alec.theriault@gmail.com>2018-11-10 16:02:13 -0800
committerAlec Theriault <alec.theriault@gmail.com>2018-11-10 16:02:13 -0800
commit959033d592b41235896402a64703650df77c34bd (patch)
tree352d1c64c354017adc5b7c3c6aa7aa7fd95e1bf6 /haddock-api/src/Haddock/Backends/Hoogle.hs
parentb62c9542480d629bb482f5394dec2fdd5a48af24 (diff)
parentf4d53a159642aa9182241259709659e7074425d5 (diff)
Merge branch 'ghc-8.6' into ghc-head
Diffstat (limited to 'haddock-api/src/Haddock/Backends/Hoogle.hs')
-rw-r--r--haddock-api/src/Haddock/Backends/Hoogle.hs21
1 files changed, 13 insertions, 8 deletions
diff --git a/haddock-api/src/Haddock/Backends/Hoogle.hs b/haddock-api/src/Haddock/Backends/Hoogle.hs
index d6a6a12d..73a200f0 100644
--- a/haddock-api/src/Haddock/Backends/Hoogle.hs
+++ b/haddock-api/src/Haddock/Backends/Hoogle.hs
@@ -118,10 +118,14 @@ commaSeparate dflags = showSDocUnqual dflags . interpp'SP
ppExport :: DynFlags -> ExportItem GhcRn -> [String]
ppExport dflags ExportDecl { expItemDecl = L _ decl
- , expItemMbDoc = (dc, _)
+ , expItemPats = bundledPats
+ , expItemMbDoc = mbDoc
, expItemSubDocs = subdocs
, expItemFixities = fixities
- } = ppDocumentation dflags dc ++ f decl ++ ppFixities
+ } = concat [ ppDocumentation dflags dc ++ f d
+ | (d, (dc, _)) <- (decl, mbDoc) : bundledPats
+ ] ++
+ ppFixities
where
f (TyClD _ d@DataDecl{}) = ppData dflags d subdocs
f (TyClD _ d@SynDecl{}) = ppSynonym dflags d
@@ -136,12 +140,13 @@ ppExport dflags ExportDecl { expItemDecl = L _ decl
ppExport _ _ = []
ppSigWithDoc :: DynFlags -> Sig GhcRn -> [(Name, DocForDecl Name)] -> [String]
-ppSigWithDoc dflags (TypeSig _ names sig) subdocs
- = concatMap mkDocSig names
- where
- mkDocSig n = mkSubdoc dflags n subdocs [pp_sig dflags [n] (hsSigWcType sig)]
-
-ppSigWithDoc _ _ _ = []
+ppSigWithDoc dflags sig subdocs = case sig of
+ TypeSig _ names t -> concatMap (mkDocSig "" (hsSigWcType t)) names
+ PatSynSig _ names t -> concatMap (mkDocSig "pattern " (hsSigType t)) names
+ _ -> []
+ where
+ mkDocSig leader typ n = mkSubdoc dflags n subdocs
+ [leader ++ pp_sig dflags [n] typ]
ppSig :: DynFlags -> Sig GhcRn -> [String]
ppSig dflags x = ppSigWithDoc dflags x []