New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added version information to haddock page title of executables #1336 #3959
base: master
Are you sure you want to change the base?
Conversation
} | ||
fromLibrary :: PackageDescription | ||
-> Library | ||
-> Verbosity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By convention, the Verbosity
argument should go first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opted for this to not have to eta-expand things. I'll change.
fromExecutable :: Verbosity | ||
fromExecutable :: PackageDescription | ||
-> Executable | ||
-> Verbosity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^^ ditto
type ModuleFiles = [(ModuleName.ModuleName, FilePath)] | ||
fromTarget :: (LocalBuildInfo -> ComponentLocalBuildInfo | ||
-> target -> IO ModuleFiles) | ||
-> (HaddockArgs -> HaddockArgs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This argument seems unnecessary -- you can just do amendArgs <$> fromTarget ...
in fromLibrary
/fromExe
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch... you're right. This is incremental hacking. Good catch
fromLibrary verbosity tmp lbi lib clbi htmlTemplate haddockVersion = do | ||
inFiles <- map snd `fmap` getLibSourceFiles lbi lib clbi | ||
type ModuleFiles = [(ModuleName.ModuleName, FilePath)] | ||
fromTarget :: (LocalBuildInfo -> ComponentLocalBuildInfo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bikeshedding: I'd rename it to fromLibOrExe
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In principle we could Haddock tests and executables, couldn't we? Given the type signature fromTarget seems appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not passionate either way, but considering @ezyang's comment, I'll stick with fromTarget
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
Looks OK. In the future, can you please split refactorings and functionality changes into different commits? |
inFiles <- map snd `fmap` getLibSourceFiles lbi lib clbi | ||
type ModuleFiles = [(ModuleName.ModuleName, FilePath)] | ||
fromTarget :: (LocalBuildInfo -> ComponentLocalBuildInfo | ||
-> target -> IO ModuleFiles) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, if you have a higher-order argument like this, doc is especially important. In this case, the passed in function is supposed to list the sources of the module in question. But why isn't just inFiles
passed in as an argument? (UPDATE: I guess the answer is, "because it saves less typing at the use site")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it was of typing at the use site... It's a subjective trade-off, but I went for compactness.
fromExecutable verbosity tmp lbi exe clbi htmlTemplate haddockVersion = do | ||
inFiles <- map snd `fmap` getExeSourceFiles lbi exe clbi | ||
ifaceArgs <- getInterfaces verbosity lbi clbi htmlTemplate | ||
let vanillaOpts = (componentGhcOptions normal lbi bi clbi (buildDir lbi)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rest of the comments are just stylistic fluff (and can be ignored), but this has got me worried. I don't see this code anywhere in the new diff. This code seems to be solving a very specific problem (interface file overwriting) and I don't see (1) any code in the new diff to handle it, or (2) a comment in the commit saying why this is not a problem anymore. It's possible it isn't (esp if the CI passes) but that is very non-obvious!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 295 in the new version (fromTarget
); did I miss something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right! This is what I get for assuming that the original code hadn't copy-pasted the damn code :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On splitting out into separate diffs (@23Skidoo); yes, you're right. Things had already happened when I realised. Apologies for the conflation.
inFiles <- map snd `fmap` getLibSourceFiles lbi lib clbi | ||
type ModuleFiles = [(ModuleName.ModuleName, FilePath)] | ||
fromTarget :: (LocalBuildInfo -> ComponentLocalBuildInfo | ||
-> target -> IO ModuleFiles) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it was of typing at the use site... It's a subjective trade-off, but I went for compactness.
type ModuleFiles = [(ModuleName.ModuleName, FilePath)] | ||
fromTarget :: (LocalBuildInfo -> ComponentLocalBuildInfo | ||
-> target -> IO ModuleFiles) | ||
-> (HaddockArgs -> HaddockArgs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch... you're right. This is incremental hacking. Good catch
} | ||
fromLibrary :: PackageDescription | ||
-> Library | ||
-> Verbosity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opted for this to not have to eta-expand things. I'll change.
fromLibrary verbosity tmp lbi lib clbi htmlTemplate haddockVersion = do | ||
inFiles <- map snd `fmap` getLibSourceFiles lbi lib clbi | ||
type ModuleFiles = [(ModuleName.ModuleName, FilePath)] | ||
fromTarget :: (LocalBuildInfo -> ComponentLocalBuildInfo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not passionate either way, but considering @ezyang's comment, I'll stick with fromTarget
fromExecutable :: Verbosity | ||
fromExecutable :: PackageDescription | ||
-> Executable | ||
-> Verbosity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^^ ditto
fromExecutable verbosity tmp lbi exe clbi htmlTemplate haddockVersion = do | ||
inFiles <- map snd `fmap` getExeSourceFiles lbi exe clbi | ||
ifaceArgs <- getInterfaces verbosity lbi clbi htmlTemplate | ||
let vanillaOpts = (componentGhcOptions normal lbi bi clbi (buildDir lbi)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 295 in the new version (fromTarget
); did I miss something?
I'm OK with merging this! |
IIUC, @holzensp wants to address some review comments before merging. |
@holzensp: hi! would you like to rebase/revisit this PR? I'm assuming the functionality is not implemented elsewhere, but if while rebasing you find that it is, this is also good to know and perhaps the current implementation may be improved using this old PR. |
Marking this PR as draft 🙂 |
Minor request; add version numbers to the page titles of the haddock documentation of executables.