From b455abf0132b109512f967af917cd516b69d1c01 Mon Sep 17 00:00:00 2001 From: Duncan Coutts Date: Wed, 27 Aug 2014 13:49:31 +0100 Subject: Changes due to ghc api changes in package representation Also fix a bug with finding the package name and version given a module. This had become wrong due to the package key changes (it was very hacky in the first place). We now look up the package key in the package db to get the package info properly. Conflicts: haddock-api/src/Haddock.hs --- haddock-api/src/Haddock/Backends/Hoogle.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'haddock-api/src/Haddock/Backends/Hoogle.hs') diff --git a/haddock-api/src/Haddock/Backends/Hoogle.hs b/haddock-api/src/Haddock/Backends/Hoogle.hs index dd2e7387..3ea73db5 100644 --- a/haddock-api/src/Haddock/Backends/Hoogle.hs +++ b/haddock-api/src/Haddock/Backends/Hoogle.hs @@ -25,6 +25,7 @@ import Outputable import Data.Char import Data.List import Data.Maybe +import Data.Version import System.FilePath import System.IO @@ -34,13 +35,14 @@ prefix = ["-- Hoogle documentation, generated by Haddock" ,""] -ppHoogle :: DynFlags -> String -> String -> String -> Maybe (Doc RdrName) -> [Interface] -> FilePath -> IO () +ppHoogle :: DynFlags -> String -> Version -> String -> Maybe (Doc RdrName) -> [Interface] -> FilePath -> IO () ppHoogle dflags package version synopsis prologue ifaces odir = do let filename = package ++ ".txt" contents = prefix ++ docWith dflags (drop 2 $ dropWhile (/= ':') synopsis) prologue ++ ["@package " ++ package] ++ - ["@version " ++ version | version /= ""] ++ + ["@version " ++ showVersion version + | not (null (versionBranch version)) ] ++ concat [ppModule dflags i | i <- ifaces, OptHide `notElem` ifaceOptions i] h <- openFile (odir filename) WriteMode hSetEncoding h utf8 -- cgit v1.2.3