[commit: haddock] master, wip/api-annots-ghc-7.10-3: Fully qualify names in Hoogle instances output (fdc4e8a)
git at git.haskell.org
git at git.haskell.org
Wed Jul 8 08:37:55 UTC 2015
Repository : ssh://git@git.haskell.org/haddock
On branches: master,wip/api-annots-ghc-7.10-3
Link : http://git.haskell.org/haddock.git/commitdiff/fdc4e8a1cafdb5accb8cef05c60579df9d438fd7
>---------------------------------------------------------------
commit fdc4e8a1cafdb5accb8cef05c60579df9d438fd7
Author: Mateusz Kowalczyk <fuuzetsu at fuuzetsu.co.uk>
Date: Fri Mar 27 01:45:18 2015 +0000
Fully qualify names in Hoogle instances output
Closes #263
>---------------------------------------------------------------
fdc4e8a1cafdb5accb8cef05c60579df9d438fd7
haddock-api/src/Haddock/Backends/Hoogle.hs | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/haddock-api/src/Haddock/Backends/Hoogle.hs b/haddock-api/src/Haddock/Backends/Hoogle.hs
index ef86958..3ffa582 100644
--- a/haddock-api/src/Haddock/Backends/Hoogle.hs
+++ b/haddock-api/src/Haddock/Backends/Hoogle.hs
@@ -95,13 +95,15 @@ dropComment (x:xs) = x : dropComment xs
dropComment [] = []
-out :: Outputable a => DynFlags -> a -> String
-out dflags = f . unwords . map (dropWhile isSpace) . lines . showSDocUnqual dflags . ppr
+outWith :: Outputable a => (SDoc -> String) -> a -> [Char]
+outWith p = f . unwords . map (dropWhile isSpace) . lines . p . ppr
where
f xs | " <document comment>" `isPrefixOf` xs = f $ drop 19 xs
f (x:xs) = x : f xs
f [] = []
+out :: Outputable a => DynFlags -> a -> String
+out dflags = outWith $ showSDocUnqual dflags
operator :: String -> String
operator (x:xs) | not (isAlphaNum x) && x `notElem` "_' ([{" = '(' : x:xs ++ ")"
@@ -156,8 +158,8 @@ ppClass dflags x = out dflags x{tcdSigs=[]} :
ppInstance :: DynFlags -> ClsInst -> [String]
-ppInstance dflags x = [dropComment $ out dflags x]
-
+ppInstance dflags x =
+ [dropComment $ outWith (showSDocForUser dflags alwaysQualify) x]
ppSynonym :: DynFlags -> TyClDecl Name -> [String]
ppSynonym dflags x = [out dflags x]
More information about the ghc-commits
mailing list