Add InstallPlan invariant assertion checking
Add InstallPlan invariant assertion checking

It turns out that the install plan elaboration is constructing cyclic
plans in some cases. The effect is that executing the plan simply misses
out anything that depends on the packages involved in the cycle. This is
probably the cause of #3996

With this patch such cases will fail with an assertion such as:

internal error in InstallPlan.fromSolverInstallPlanWithProgress:
The following packages are involved in a dependency cycle
hspec-discover-2.3.1-da63d0b4e952e7949a113646e4af0aac925a4d864a1db650..

The cause is clearly in the caller of fromSolverInstallPlanWithProgress
and the only caller of that is ProjectPlanning.elaborateInstallPlan.
The problem appears to be to do with the intra-package dependencies.

themoritz/cabal,themoritz/cabal,mydaum/cabal,themoritz/cabal,mydaum/cabal