Clean up remnants left in GHC's package directory that may be left over from
previous installations. See for example #46611, which has a log of all the
superfluous files left on the buildbots, which should be cleaned up by this.

Modify portgroups to register configuration files in
$prefix/lib/ghc-7.8.3/package.conf.d/ directly before calling ghc-pkg recache
rather than using activation and deactivation scripts that indirectly create
these files to avoid the same mess in the future. This way, the state in the
package cache directory will always represent the same state MacPorts
expects.

Simplify and clean up some of the portgroups, especially related to variable
substitution in pre-/post-activation hooks.

Avoid duplicating most of the code in the haskellplatform 2.0 portgroup and
just refer back to the haskell 1.0 portgroup instead.

Apply the hook variable substitution cleanup to the local helper functions in
the haskell-platform Portfile.

This change

should finally fix #46611 and #42082 and all the weird little
misconfigurations that would occasionally occur on users' machines

breaks manual installation of haskell packages (e.g. using cabal) in the
system directory, because the ghc Portfile will clean out everything that
isn't owned by a port in the package cache directory. If this affects you,
be advised that you should not be putting stuff MacPorts doesn't know about
in MacPorts' prefix. Instead, please use user installations of these
packages.