Skip to content

Comp/doc and refactoring - #5460

Closed
theobat wants to merge 1 commit into
commercialhaskell:masterfrom
theobat:comp/doc-and-refactoring
Closed

theobat wants to merge 1 commit into
commercialhaskell:masterfrom
theobat:comp/doc-and-refactoring

Conversation

@theobat

@theobat theobat commented Dec 20, 2020

Copy link
Copy Markdown
Contributor

This is mostly a doc PR, but it also contains the following refactorings (no actual behavior has been touched, these are "pure" refactorings):

  • Rename lpWanted to lpShouldBeBuilt
  • move printPlan and displayTask in thee Build.hs file (where Plan and Task are defined)
  • isolate the merging of planTasks and planFinals into their own function (and remove mergeWithKeys as it's recommended to not use it in its haddock) defined in Build.hs.
  • a reorganization of toAction which transforms a task into an action. This was using very redundantly the Task constructor, and the task -> action is likely to change with component builds.
  • rename W and M in ConstructPlan to more sensible names. Minor other changes there.

Overall, I mostly realized that contrary to my plan in #4745 (comment), it's going to be hard to do anything before actually changing the Setup.hs part, so I'm going to tackle this first, then all the Package/ConstructPlan/Installed can get a sensible rework.
The Execute.hs file is a beast, it's really hard to navigate, so I'm likely to refactor it a bit more.

This can be merged for now though, because I think it eases the reading and the understanding of the codebase on its own.

@qrilka qrilka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In principle I'm OK with this PR. Just see some notes regarding haddocks.
But I'm not sure it makes sense to merge it right into master. If you want to track different steps of component-based builds then one option could be to add a new branch for it and do PRs into it.
And one more note - what about squashing commits like "minor improvements"?

Comment thread src/Stack/Types/Config.hs Resolved
Comment thread src/Stack/Types/Package.hs Outdated
-- Absent in cabal.
,packageDeps :: !(Map PackageName DepValue)
-- ^ Packages that the package depends on, both as libraries and build tools.
-- Likely derived from cabal:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks a bit odd to have "likely" in haddocks for our own definitions...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but it's better than nothing. I didn't actually track all the fields down, because there are a number of hacks on pretty much all of them, the idea of this is to understand why everything is needed and how we can better address these needs. I agree it's not the best, maybe we should wait for the actual component changes on Packge to merge this then.

Comment thread src/Stack/Types/Package.hs Outdated
,packageBuildType :: !BuildType -- ^ Package build-type.
Package {packageName :: !PackageName
-- ^ Name of the package.
-- This is PackageIdentifier pkgName in cabal.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably it we should use Cabal as a way to refer to the Cabal library. I.e. start with the capital C

Comment thread stack.code-workspace Outdated
@@ -0,0 +1,7 @@
{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this file really belong to this PR?

@theobat

theobat commented Dec 21, 2020 •

Copy link
Copy Markdown
Contributor Author

So we can get take 2 different path considering this PR:

  • Clean the things and apply your comments (squashing, cleaning, etc) and merge it.
  • Wait for the actual work on component based builds and see if it makes sense to merge the "pure refactorings" as a different PR.

I don't have a strong opinion, I believe if other people are going to touch these parts of the codebase, it's better to merge this. On the other hand, some of the haddocks additions are very likely to be removed after I touch them, and they seem pretty fragile as-is.

@theobat
theobat force-pushed the comp/doc-and-refactoring branch from 15387f0 to fe2bea6 Compare December 21, 2020 14:37
@qrilka

qrilka commented Dec 22, 2020

Copy link
Copy Markdown
Contributor

@theobat what about the option I proposed? The one about a separate branch to collect a number of PRs on the topic?

@theobat

theobat commented Dec 22, 2020 •

Copy link
Copy Markdown
Contributor Author

Yes, I'm ok with your proposition as well, but I don't have the right to create the branch on the repo I believe ? (unless you meant a branch on my fork, which is fine by me as well). Feel free to close this PR (or tell me what to do :) ).

By the way, I made a mistake in the rebase hence the error.

@theobat
theobat force-pushed the comp/doc-and-refactoring branch 2 times, most recently from c522e73 to ad65aa1 Compare December 22, 2020 14:01
@qrilka

qrilka commented Dec 25, 2020

Copy link
Copy Markdown
Contributor

Sorry for a late reply, I've created https://github.com/commercialhaskell/stack/tree/component-based-builds - I guess it's a bit better to keep discussions in this repo to make them better discoverable.

- Rename lpWanted to lpShouldBeBuilt
- Move printPlan and displayTask in thee Build.hs file (where Plan and Task are defined)
- Isolate the merging of planTasks and planFinals into their own function (and remove mergeWithKeys as it's recommended to not use it in its haddock) defined in Build.hs.
- A reorganization of toAction which transforms a task into an action. This was using very redundantly the Task constructor, and the task -> action is likely to change with component builds.
- Rename W and M in ConstructPlan to more sensible names. Minor other changes there.
- Refactor Execute.hs and split the Precompiled/installed stuff into their own module.
- Various haddock additions.
- Remove PackageDepsOracle (unused)
@theobat
theobat force-pushed the comp/doc-and-refactoring branch from ad65aa1 to 2f9e194 Compare December 31, 2020 11:15
@theobat theobat closed this Dec 31, 2020
@qrilka

qrilka commented Jan 3, 2021

Copy link
Copy Markdown
Contributor

@theobat could I ask you about your new plans about this if you have them?

@theobat

theobat commented Jan 3, 2021

Copy link
Copy Markdown
Contributor Author

@qrilka I'm reopening it on the branch you created if that's ok ?

@qrilka

qrilka commented Jan 4, 2021

Copy link
Copy Markdown
Contributor

Sure, great to hear that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants