[Git][ghc/ghc][wip/ghc-internals-move-2] 2 commits: Move `base` to `ghc-internal`

Matthew Pickering (@mpickering) gitlab at gitlab.haskell.org
Wed Feb 7 11:54:06 UTC 2024



Matthew Pickering pushed to branch wip/ghc-internals-move-2 at Glasgow Haskell Compiler / GHC


Commits:
6934e497 by Ben Gamari at 2024-02-07T11:53:09+00:00
Move `base` to `ghc-internal`

Here we move a good deal of the implementation of `base` into a new
package, `ghc-internal` such that it can be evolved independently
from the user-visible interfaces of `base`.

While we want to isolate implementation from interfaces, naturally, we
would like to avoid turning `base` into a mere set of module re-exports.
However, this is a non-trivial undertaking for a variety of reasons:

 * `base` contains numerous known-key and wired-in things, requiring
   corresponding changes in the compiler

 * `base` contains a significant amount of C code and corresponding
   autoconf logic, which is very fragile and difficult to break apart

 * `base` has numerous import cycles, which are currently dealt with via
   carefully balanced `hs-boot` files

 * We must not break existing users

To accomplish this migration, I tried the following approaches:

* [Split-GHC.Base]: Break apart the GHC.Base knot to allow incremental
  migration of modules into ghc-internal: this knot is simply too
  intertwined to be easily pulled apart, especially given the rather
  tricky import cycles that it contains)

* [Move-Core]: Moving the "core" connected component of base (roughly
  150 modules) into ghc-internal. While the Haskell side of this seems
  tractable, the C dependencies are very subtle to break apart.

* [Move-Incrementally]:

  1. Move all of base into ghc-internal
  2. Examine the module structure and begin moving obvious modules (e.g.
     leaves of the import graph) back into base
  3. Examine the modules remaining in ghc-internal, refactor as necessary
     to facilitate further moves
  4. Go to (2) iterate until the cost/benefit of further moves is
     insufficient to justify continuing
  5. Rename the modules moved into ghc-internal to ensure that they don't
     overlap with those in base
  6. For each module moved into ghc-internal, add a shim module to base
     with the declarations which should be exposed and any requisite
     Haddocks (thus guaranteeing that base will be insulated from changes
     in the export lists of modules in ghc-internal

Here I am using the [Move-Incrementally] approach, which is empirically
the least painful of the unpleasant options above

Bumps haddock submodule.

Metric Decrease:
    haddock.Cabal
    haddock.base
Metric Increase:
    MultiComponentModulesRecomp
    T16875

- - - - -
e66279af by GHC GitLab CI at 2024-02-07T11:53:54+00:00
fixes

- - - - -


24 changed files:

- + .editorconfig
- + .ghcid
- + .git-ignore-revs
- + .gitattributes
- + .gitignore
- + .gitlab-ci.yml
- + .gitlab/ci.sh
- + .gitlab/common.sh
- + .gitlab/darwin/nix/sources.json
- + .gitlab/darwin/nix/sources.nix
- + .gitlab/darwin/toolchain.nix
- + .gitlab/generate-ci/LICENSE
- + .gitlab/generate-ci/README.mkd
- + .gitlab/generate-ci/flake.lock
- + .gitlab/generate-ci/flake.nix
- + .gitlab/generate-ci/gen_ci.hs
- + .gitlab/generate-ci/generate-ci.cabal
- + .gitlab/generate-ci/generate-job-metadata
- + .gitlab/generate-ci/generate-jobs
- + .gitlab/generate-ci/hie.yaml
- + .gitlab/hello.hs
- + .gitlab/issue_templates/default.md
- + .gitlab/issue_templates/documentation_issue.md
- + .gitlab/issue_templates/feature_request.md


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b77e06f743c6038f9579c86c2e253ed8cf8ced56...e66279af3993d9658a15bb35e64b0aae2af975b0

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b77e06f743c6038f9579c86c2e253ed8cf8ced56...e66279af3993d9658a15bb35e64b0aae2af975b0
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240207/469c962e/attachment.html>


More information about the ghc-commits mailing list