Skip to content
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

Simple refactoring #5926

Merged
merged 7 commits into from
Nov 12, 2022
Merged

Conversation

theobat
Copy link
Contributor

@theobat theobat commented Nov 4, 2022

This is a preparation work for #5920. It really is a simple review of unused fields and I had to move all the Dependency related types to a dedicated module because having them in Package made circular imports when moving dependencies to Components.

@mpilgrem

@theobat theobat force-pushed the simple-refactoring branch from 48db3c1 to ceab810 Compare November 6, 2022 10:23
@theobat theobat force-pushed the simple-refactoring branch 2 times, most recently from 32dc739 to d71a79c Compare November 12, 2022 00:04
@theobat
Copy link
Contributor Author

theobat commented Nov 12, 2022

@mpilgrem this one is ready to be merged it's a cleaning worth the merge no matter what. (unused functions etc)

Copy link
Member

@mpilgrem mpilgrem left a comment

Choose a reason for hiding this comment

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

Many thanks. Some (minor, I think) thoughts occured to me as I read your proposed changes.

@@ -52,6 +52,7 @@ import System.Environment (lookupEnv)
import System.IO (putStrLn)
import RIO.PrettyPrint
import RIO.Process (findExecutable, HasProcessContext (..))
import Stack.Types.Dependency (DepValue(DepValue), DepType (AsLibrary))
Copy link
Member

Choose a reason for hiding this comment

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

Please could this import line adopt the same format as used elsewhere in the module.

{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE NamedFieldPuns #-}
Copy link
Member

Choose a reason for hiding this comment

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

I did not follow what prompted this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change was motivated by a simplified tracking of what is used from the Package type (as I intend to change this type to have a more cabal-like structure as stated in the issue, and thus I have to know what is used where). It's not strictly necessary, but I believe RecordWildCards is a bad and unnecessary extension (especially in this case, when 10+ fields are used it's questionable but obviously unseful).

Comment on lines -318 to -325
testconfig = config
{ packageConfigEnableTests = True
, packageConfigEnableBenchmarks = False
}
benchconfig = config
{ packageConfigEnableTests = False
, packageConfigEnableBenchmarks = True
}
Copy link
Member

Choose a reason for hiding this comment

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

For my benefit, could you explain further why these can be safely deleted? I am not across the architectural considerations and would appreciate some help in understanding them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Honestly I don't know why it existed in the first place, as it's never been used as far as I know.

Copy link
Contributor Author

@theobat theobat Nov 12, 2022

Choose a reason for hiding this comment

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

The fields have been there for a very long time (7+ years) and I don't know at which point they stopped being used.
The reason why it's important to remove them is that, we should have dependencies tracked at the component level for mixins/backpack support, not at the LocalPackage/Package level.

@@ -77,6 +77,7 @@ import System.IO.Error
import RIO.Process
import RIO.PrettyPrint
import qualified RIO.PrettyPrint as PP (Style (Module))
import Stack.Types.Dependency (DepValue(..), DepType (..))
Copy link
Member

Choose a reason for hiding this comment

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

Please could this import line adopt the same format as used elsewhere in the module.

@@ -0,0 +1,29 @@
{-# LANGUAGE NoImplicitPrelude #-}

module Stack.Types.Dependency where
Copy link
Member

Choose a reason for hiding this comment

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

Stack's other modules tend to have express export lists.

{ dvVersionRange :: !VersionRange
, dvType :: !DepType
}
deriving (Show,Typeable)
Copy link
Member

Choose a reason for hiding this comment

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

Please could there be a space after the comma? That would be consistent within this module and with other Stack modules. (I appreciate that consistency was missing from the code you moved!)

@mpilgrem mpilgrem merged commit 36935cb into commercialhaskell:master Nov 12, 2022
@mpilgrem
Copy link
Member

@theobat, thanks for the explanations.

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