Formatting.
Fix the haddock --html-location= for relative URLs

The previous fix in isue #1407 turned out to be in the wrong place and
so applied to both the haddock-html from the ghc-pkg output, and also to
the location passed via the --html-location flag. For the
--html-location flag it is important that we can use relative URLs like
/package/$pkg-$version/docs because that is what we need for hackage.
Note that that is a relative URL, it's relative to the server root.
However that was being interpreted as a local file path and being given
the file:// prefix. So now we move the file:// URL stuff to the right
place so it only applies to the location given in the haddock-html field
of the package registration.
Similar absolute url fix for cabal-install

In this case with index generation it's more benign, but still better
to handle things consistently.
Whitespace.
Refactoring: extracting 'List.getPkgList' function out of 'List.list' function. The 'getPkgList' function returns list of packages and be used by external programs, when cabal-install becomes a library.
Merge pull request #1599 from wdanilo/master

Refactoring: extracting 'List.getPkgList' function out of 'List.list'
Copy-pasto.
Comments.