From 3dd9b226dc56b84761f413bfaf6af7bcb6c2d802 Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Tue, 11 Oct 2022 12:52:58 +0200 Subject: [PATCH] Action/Server: reverse the order of modules in showFroms This will *not* change the top-link for the target to the first module, just switch around the displayed list. We need to push the logic out a bit further to change the top target. --- src/Action/Server.hs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Action/Server.hs b/src/Action/Server.hs index e99ef333..544d1c35 100644 --- a/src/Action/Server.hs +++ b/src/Action/Server.hs @@ -284,9 +284,17 @@ showFroms urlOpts allTargets = do -- each as links to either the package -- or the target inside the respective module. $ link pkgName pkgUrl - : [ link moduleName targetUrl - | (targetUrl, moduleName) <- targets - ] + : + -- quite peculiarly, the list of modules inside each package + -- is sorted in reverse-topological order, that is downstream + -- modules are first in the result. We want the declaration module + -- to be first, so we reverse the ordering. + -- *Why* the list is in reverse topological order is not quite + -- clear to the authors, there is a good chance it’s accidental. + reverse + [ link moduleName targetUrl + | (targetUrl, moduleName) <- targets + ] showURL :: UrlOpts -> URL -> String showURL IsHaddockUrl x = "haddock/" ++ dropPrefix "file:///" x