Skip to content

Commit

Permalink
Action/Server: reverse the order of modules in showFroms
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Profpatsch committed Oct 11, 2022
1 parent b6aa989 commit 3dd9b22
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/Action/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3dd9b22

Please sign in to comment.