Follow Win64 changes in GHC
Follow changes in base
Spelling.
80-col violation.
Fix warnings.
Redundant imports.
Fix typos.
Warn when 'cpp-options: -Idir' is used instead of 'include-dirs: dir'.

I'm looking at you, ansi-terminal.
Fix a typo (s/reative/relative/).
Add -threaded and -rtsopts to cabal-install's ghc-options.

We don't want FFI calls to block all Haskell threads, so we need to use the
threaded runtime; -rtsopts is for experimenting with the number of capabilities.
Make a diagnostic more clear.

It can be non-obvious why a package is registered more than once.
Add a '-j' flag for the 'install' command.
InstallPlan: Add a Processing package state.

We don't want 'InstallPlan.ready' to return packages that are currently
being processed in other threads.
Parallelise the install command This is based on Mikhail Glushenkov's patches.

It adds a '-j N' (= 'number of jobs') option for the 'install' command, which
can be used to specify the number of concurrent workers. If possible, at most
N packages will be built concurrently.

This version of the patch is less featureful than Mikhail's version but also
rather simpler. The key difference compared to Mikhail's version is that this
version is lacking the output serialisation and the ability to tag each output
message with the task it came from. All output is interleaved. The next step
will be to make parallel builds log to files rather than the console and only
to display a summary on the console.

In addition to not having to change the output functions, the code is a bit
simpler by keep the structure of the code the same as before, rather than
splitting it into a number of concurrent tasks with channels. Instead each
task simply executes the same pattern of install actions and concurrency
limits are enforced using semaphores.
Drop the "ghc-options: -rtsopts" on cabal-install. We do not need it.
Fix impl of PackageIndex.allPackagesByName

Fixes the problem with generating the haddock documentation contents page for
all installed packages. Previously we were (accidentally) telling haddock to
use all versions of each package and haddock would pick the first (lowest
version). Now we correctly do what we were trying to do all along, which is
to pick only the highest version of each package.
Add a check for -fdefer-type-errors

It should not be used in packages ready for being distributed.
Remove use of bogus mingw32_TARGET_OS cpp define
Fix missing import after merge of par build patches
Add the missing JobControl module

Needed for the parallel builds.