aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/Backends/Xhtml.hs
diff options
context:
space:
mode:
authorAlec Theriault <alec.theriault@gmail.com>2018-12-17 09:25:10 -0500
committerGitHub <noreply@github.com>2018-12-17 09:25:10 -0500
commited43757aa371f9a532665783e27cff1703b4ac90 (patch)
treed797068322124edcd022ebb1a2873a8b7157f0bf /haddock-api/src/Haddock/Backends/Xhtml.hs
parent1380f7fa048ba26f79944452722dff0800b49038 (diff)
Refactor names + unused functions (#982)
This commit should not introduce any change in functionality! * consistently use `getOccString` to convert `Name`s to strings * compare names directly when possible (instead of comparing strings) * get rid of unused utility functions
Diffstat (limited to 'haddock-api/src/Haddock/Backends/Xhtml.hs')
-rw-r--r--haddock-api/src/Haddock/Backends/Xhtml.hs7
1 files changed, 2 insertions, 5 deletions
diff --git a/haddock-api/src/Haddock/Backends/Xhtml.hs b/haddock-api/src/Haddock/Backends/Xhtml.hs
index da8f7a53..9add4cae 100644
--- a/haddock-api/src/Haddock/Backends/Xhtml.hs
+++ b/haddock-api/src/Haddock/Backends/Xhtml.hs
@@ -39,7 +39,7 @@ import Haddock.GhcUtils
import Control.Monad ( when, unless )
import qualified Data.ByteString.Builder as Builder
import Data.Char ( toUpper, isSpace )
-import Data.List ( sortBy, isPrefixOf, intercalate, intersperse )
+import Data.List ( sortBy, isPrefixOf, intersperse )
import Data.Maybe
import System.Directory
import System.FilePath hiding ( (</>) )
@@ -388,7 +388,7 @@ ppJsonIndex odir maybe_source_url maybe_wiki_url unicode pkg qual_opt ifaces = d
| Just item_html <- processExport True links_info unicode pkg qual item
= [ Object
[ "display_html" .= String (showHtmlFragment item_html)
- , "name" .= String (intercalate " " (map nameString names))
+ , "name" .= String (unwords (map getOccString names))
, "module" .= String (moduleString mdl)
, "link" .= String (fromMaybe "" (listToMaybe (map (nameLink mdl) names)))
]
@@ -406,9 +406,6 @@ ppJsonIndex odir maybe_source_url maybe_wiki_url unicode pkg qual_opt ifaces = d
exportName ExportNoDecl { expItemName } = [expItemName]
exportName _ = []
- nameString :: NamedThing name => name -> String
- nameString = occNameString . nameOccName . getName
-
nameLink :: NamedThing name => Module -> name -> String
nameLink mdl = moduleNameUrl' (moduleName mdl) . nameOccName . getName