Action/Generate: Add relocatable option - #449
Conversation
fgaz-scrive
commented
Aug 1, 2025
Friendly ping |
fgaz-scrive
commented
Oct 16, 2025
Ping :) Is there anything I can do to move this forward? |
Bodigrim
commented
Nov 23, 2025
@fgaz-scrive could you please rebase to trigger a CI run? |
Uh oh!
There was an error while loading. Please reload this page.
| | [] <- local_ -> do readHaskellOnline timing settings doDownload | ||
| | otherwise -> readHaskellDirs timing settings local_ | ||
| | relocatable, _:_:_ <- local_ -> | ||
| exitFail "Error: --relocatable needs exactly one --local, or the paths will be ambiguous" |
There was a problem hiding this comment.
Could we validate this condition earlier? E. g., could our command line interface be --local [PATH] | --relocatable PATH, so that the configuration is valid by construction?
There was a problem hiding this comment.
could our command line interface be
--local [PATH] | --relocatable PATH
We'd still have to check that only one of those is supplied, unless cmdargs supports submodes and a breaking change is OK.
I pushed a separate commit with the change so you can compare and possibly revert.
Bodigrim
commented
Dec 7, 2025
@fgaz@fgaz-scrive are you still interested in this? |
fgaz
commented
Dec 7, 2025
Yes, I'll follow up next week |
e44d045 to
7de85f0CompareThis is useful for example if you generate the haddocks and the index in CI and deploy them to another machine at a different path.
7de85f0 to
ecb4b9fCompare
Bodigrim
left a comment
There was a problem hiding this comment.
Thanks! How can I test the new feature?
| | Just _ <- relocatable, _:_ <- local_ -> | ||
| exitFail "Error: --relocatable and --local are mutually exclusive" | ||
| | Just relocatable' <- relocatable -> do | ||
| prefix <- traverse canonicalizePath relocatable |
There was a problem hiding this comment.
Could it be
| prefix <-traversecanonicalizePath relocatable | |
| prefix <- canonicalizePath relocatable' |
?
There was a problem hiding this comment.
Sure. I just have to wrap it back later, but it makes sense to do so because it's a different context with a different meaning. Done.
| let url = "file://" ++ ['/' | not $ "/" `isPrefixOf` dir] ++ replace "\\" "/" dir ++ "/" | ||
| let url = case prefixToRemove of | ||
| Just prefix -> makeRelative prefix $ replace "\\" "/" dir ++ "/" | ||
| Nothing -> "file://" ++ ['/' | not $ "/" `isPrefixOf` dir] ++ replace "\\" "/" dir ++ "/" |
There was a problem hiding this comment.
Could we please factor out replace "\\" "/" dir ++ "/" so that it's not repeated?
There was a problem hiding this comment.
Done. While I was at it I also changed it to use isPathSeparator.
fgaz-scrive
commented
Jan 9, 2026
In any cabal project: cabal haddock-project
hoogle generate --local=haddocks/ --database=regular.db
hoogle generate --relocatable=haddocks/ --database=relocatable.db
# "Deploy" the haddocks and hoogle databases
tmp="$(mktemp -d)"
mv regular.db relocatable.db haddocks "$tmp"# Links from hoogle results to haddocks will not work
hoogle serve --database="$tmp/regular.db" --haddock="$tmp/haddocks/"# Links from hoogle results to haddocks will work
hoogle serve --database="$tmp/relocatable.db" --haddock="$tmp/haddocks/" |
fgaz-scrive
commented
Jan 27, 2026
@Bodigrim ping |
Bodigrim
commented
Jan 27, 2026
Sorry for delay, we discovered that hoogle.haskell.org was using a patched version of Hoogle and now waiting to upstream the patches in #468 before accumulating more changes in |
fgaz-scrive
commented
Jun 12, 2026
is there any way I could help with that? |
This is useful for example if you generate the haddocks and the index in CI and deploy them to another machine at a different path.
Thanks for the pull request!
By raising this pull request you confirm you are licensing your contribution under all licenses that apply to this project (see LICENSE) and that you have no patents covering your contribution.
If you care, my PR preferences are at https://github.com/ndmitchell/neil#contributions, but they're all guidelines, and I'm not too fussy - you don't have to read them.