Skip to content

Potential Refactors

Francesco Gazzetta edited this page Oct 12, 2018 · 11 revisions

Summary

Name Short description Estimated time Estimated difficulty Estimated risk PRs
UnresolvedPkgLoc Remove some maybes from PackageLocation, since in some places Nothing never gets used 2-3h 2/5 2/5
Dependency as constraint 3/5 4/5
Maybe UnqualComponentName 1/5 1/5

Details

UnresolvedPkgLoc

In ElaboratedConfiguredPackage.elabPkgSourceLocation, RemoteSourceRepoPackage cannot have a Nothing, but PackageLocation often has Maybe Filepath as local, leading to impossible cases like this one and silly code like this one.

We should remove the maybe wherever is possible.

@fgaz attempted this refactor here (remember to grep for undefined). Here's the only place where he found a Nothing: https://github.com/haskell/cabal/blob/26938a5958088f3cf493b79cab0bfcd3d0ca7c71/cabal-install/Distribution/Client/IndexUtils.hs#L316

Maybe PackageLocation should have two type params: one for RepoTarballPackage (which can be Nothing) and one for the rest. Or just one for RepoTarballPackage.

Dependency as constraint

See https://github.com/fgaz/gsoc/blob/master/2018/final-report.md#the-dependency-as-constraint-problem

Maybe UnqualComponentName

See https://github.com/fgaz/gsoc/blob/master/2018/final-report.md#the-pervasive-maybe-unqualcomponentname