-
Notifications
You must be signed in to change notification settings - Fork 724
Description
Problems
with fields
These field names have the prefix with:
withPrograms :: ProgramConfigurationwithPackageDB :: PackageDBStackwithVanillaLib :: BoolwithProfLib :: BoolwithSharedLib :: BoolwithDynExe :: BoolwithProfExe :: BoolwithProfLibDetail :: ProfDetailLevelwithProfExeDetail :: ProfDetailLevelwithOptimization :: OptimisationLevelwithDebugInfo :: DebugInfoLevelwithGHCiLib :: Bool
In usual Haskell parlance, with indicates a function in continuation passing style, but these are simple accessors.
Singular/Plural
These fields refer to executables, libraries, or package databases in the singular, which is incorrect because we handle multiple of each simultaneously:
withPackageDB :: PackageDBStackwithVanillaLib :: BoolwithProfLib :: BoolwithSharedLib :: BoolwithDynExe :: BoolwithProfExe :: BoolwithProfLibDetail :: ProfDetailLevelwithProfExeDetail :: ProfDetailLevel
Duplicated fields
We have
withProfLib :: BoolandwithProfLibDetail :: ProfDetailLevelwithProfExe :: BoolandwithProfExeDetail :: ProfDetailLevel
when libProfiling :: Maybe ProfDetailLevel and exeProfiling :: Maybe ProfDetailLevel would be more idiomatic.
Essentially-unused fields
The program configuration in withPrograms :: ProgramConfiguration can't actually be serialized. Also, the programs in use can and often are reconfigured after the package is configured! Package configuration and program configuration are separate issues.
Proposed Solutions
- Rename the
with-prefixed fields. - Add fields
libProfiling :: Maybe ProfDetailLevelandexeProfiling :: Maybe ProfDetailLevel. - Split
LocalBuildInfointoPackageConfig(which would have most of the same fields asLocalBuildInfo) and a separateProgramConfiguration.
Compatibility
I can add deprecated accessors for all the renamed and removed fields. However, code which assigns those fields will have to change.
Splitting up LocalBuildInfo internally does not need to affect external code because we can always reconstruct a LocalBuildInfo for legacy interfaces.