Description
Problems
with
fields
These field names have the prefix with
:
withPrograms :: ProgramConfiguration
withPackageDB :: PackageDBStack
withVanillaLib :: Bool
withProfLib :: Bool
withSharedLib :: Bool
withDynExe :: Bool
withProfExe :: Bool
withProfLibDetail :: ProfDetailLevel
withProfExeDetail :: ProfDetailLevel
withOptimization :: OptimisationLevel
withDebugInfo :: DebugInfoLevel
withGHCiLib :: 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 :: PackageDBStack
withVanillaLib :: Bool
withProfLib :: Bool
withSharedLib :: Bool
withDynExe :: Bool
withProfExe :: Bool
withProfLibDetail :: ProfDetailLevel
withProfExeDetail :: ProfDetailLevel
Duplicated fields
We have
withProfLib :: Bool
andwithProfLibDetail :: ProfDetailLevel
withProfExe :: Bool
andwithProfExeDetail :: 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 ProfDetailLevel
andexeProfiling :: Maybe ProfDetailLevel
. - Split
LocalBuildInfo
intoPackageConfig
(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.