alexwl / haskell-code-explorer

Web application for exploring and understanding Haskell codebases
MIT License
509 stars 20 forks source link

Hackage links are broken #6

Closed dkasak closed 5 years ago

dkasak commented 5 years ago

Links to documentation on Hackage are broken since they're missing src/ in the URL.

e.g. clicking on "Go to definition" for Enum leads to https://hackage.haskell.org/package/base-4.9.1.0/docs/GHC-Enum.html#t:Enum instead of https://hackage.haskell.org/package/base-4.9.1.0/docs/src/GHC-Enum.html#t:Enum.

dkasak commented 5 years ago

Actually, the dash in the package name should also be replaced with a dot and there's no t: prefix in the HTML fragment, e.g. https://hackage.haskell.org/package/base-4.9.1.0/docs/src/GHC.Enum.html#Enum

Edit: Hmm, but I see you're handling all of those things explicitly like that. Did they change it in the meantime?

alexwl commented 5 years ago

Links to hypelinked source code on Hackage contain /src/, for example: https://hackage.haskell.org/package/base-4.10.1.0/docs/src/System.IO.html#print

Links to HTML documentation are without /src/: https://hackage.haskell.org/package/base-4.10.1.0/docs/System-IO.html#v:print

At the moment, haskell-code-explorer tries to generate links to HTML documentation. Unfortunately, sometimes generated links don't work. The link to the documentation of Enum type class https://hackage.haskell.org/package/base-4.9.1.0/docs/GHC-Enum.html#t:Enum doesn't work because GHC.Enum module is not documented on Hackage. The correct link to the documentation of Enum type class should be https://hackage.haskell.org/package/base-4.9.1.0/docs/Prelude.html#t:Enum. haskell-code-explorer doesn't know that module GHC.Enum should be replaced with Prelude.

Now, I think that it is better to generate links to hyperlinked source code, not to HTML documentation. I've committed the fix : https://github.com/alexwl/haskell-code-explorer/commit/579a0f16c4f3ad2bcc8a283081d214fbe1ee3a59

dkasak commented 5 years ago

Ah, that explains it. This had me confused for a bit. I just had a bit of bad luck in that the very first thing I clicked on didn't work. :)

I think this is a good solution for now. Feel free to close as far as I'm concerned.