Skip to content

Commit 461a1c2

Browse files
authored
Merge pull request #58 from bgamari/patch-2
base-libraries: Rename ghc-internals -> ghc-internal
2 parents 2974287 + 4d5c6df commit 461a1c2

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

proposals/accepted/051-ghc-base-libraries.rst

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ Proposal
8383

8484
We propose to divide ``base`` into three packages:
8585

86-
- ``ghc-internals``: exposes aspects of GHC's internals that may be of interest to "hard-core" developers interested in maximum performance (see `Nikita's blog post <https://nikita-volkov.github.io/internal-convention-is-a-mistake/>`__).
87-
The API of ``ghc-internals`` is fully under the control of the GHC team, and of no direct interest to the CLC — only its effects on the API of base.
86+
- ``ghc-internal``: exposes aspects of GHC's internals that may be of interest to "hard-core" developers interested in maximum performance (see `Nikita's blog post <https://nikita-volkov.github.io/internal-convention-is-a-mistake/>`__).
87+
The API of ``ghc-internal`` is fully under the control of the GHC team, and of no direct interest to the CLC — only its effects on the API of base.
8888

8989
- ``base``: as now, whose API is curated by CLC.
90-
Depends on ``ghc-internals``, and hence on ``ghc-bignum`` and ``ghc-prim``.
90+
Depends on ``ghc-internal``, and hence on ``ghc-bignum`` and ``ghc-prim``.
9191

92-
- ``ghc-experimental``, initially empty, depends on ``base`` and on ``ghc-internals``.
92+
- ``ghc-experimental``, initially empty, depends on ``base`` and on ``ghc-internal``.
9393
Functions and data types here are intended to have their ultimate home in base, but while they are settling down they are subject to much weaker stability guarantees.
9494
Generally, new functions and types introduced in GHC Proposals would start their life here.
9595
Example: new type families and type constructors for tuples, `GHC Proposal #475 <https://github.com/ghc-proposals/ghc-proposals/pull/475>`__.
@@ -103,12 +103,12 @@ All three packages conform rigorously to the PVP.
103103

104104
Some observations about this structure:
105105

106-
- We should develop both social and technical mechanisms to discourage people from depending directly on ``ghc-internals``, because if such dependencies become frequent and ossified, it will lead to future pain when the API changes.
107-
The very name ``ghc-internals`` should serve as a very strong signal in its own right, but even so, saying "we told you not to rely on it" may be true but won't lessen that pain.
106+
- We should develop both social and technical mechanisms to discourage people from depending directly on ``ghc-internal``, because if such dependencies become frequent and ossified, it will lead to future pain when the API changes.
107+
The very name ``ghc-internal`` should serve as a very strong signal in its own right, but even so, saying "we told you not to rely on it" may be true but won't lessen that pain.
108108
The specific mechanisms do not form part of this proposal, but some possibilities are `discussed in a separate section <#discourage-brainstorm>`__.
109109

110110
Note: "discourage" does not imply "ban".
111-
It must remain possible for hard-core developers to depend on `ghc-internals`.
111+
It must remain possible for hard-core developers to depend on `ghc-internal`.
112112
Our goal is only that naive developers should not do so by accident.
113113

114114
- In contrast, clients are *not* discouraged from depending on ``ghc-experimental``; although again its name should convey the idea that it might change at short notice.
@@ -134,11 +134,11 @@ Some observations about this structure:
134134

135135
This is going to disappear from base.
136136
You probably don't want to use it at all.
137-
But if you absolutely must, get it from ``ghc-internals``.
137+
But if you absolutely must, get it from ``ghc-internal``.
138138

139-
- To expose a new function from ``ghc-internals`` requires that any functions on which it depends are also in ``ghc-internals`` (not base).
140-
So we may need to move code from ``base`` to ``ghc-internals``, leaving a shim behind in base.
141-
In practice, that may mean that quite a lot of code will move into ``ghc-internals`` quite quickly.
139+
- To expose a new function from ``ghc-internal`` requires that any functions on which it depends are also in ``ghc-internal`` (not base).
140+
So we may need to move code from ``base`` to ``ghc-internal``, leaving a shim behind in base.
141+
In practice, that may mean that quite a lot of code will move into ``ghc-internal`` quite quickly.
142142
But that's fine: *it is just an implementation matter*: provided the modules, exports, and API of ``base`` are maintained, it is immaterial to clients (and hence to CLC) exactly *how* they are maintained.
143143

144144
- This proposal is fully compatible with, and actively supports, the `CLC charter <https://github.com/haskell/core-libraries-committee#base-package>`__:
@@ -153,13 +153,13 @@ Some observations about this structure:
153153

154154
- allowing the GHC Steering Committee to add new functions and types in ``ghc-experimental``.
155155

156-
- The three "internal" packages: ``ghc-internals``, ``ghc-bignum``, and ``ghc-prim``, could arguably be a single package, but the GHC team has decided that encapsulating the relevant code in this way helps to keep dependencies and responsibilities clear.
156+
- The three "internal" packages: ``ghc-internal``, ``ghc-bignum``, and ``ghc-prim``, could arguably be a single package, but the GHC team has decided that encapsulating the relevant code in this way helps to keep dependencies and responsibilities clear.
157157
And it's purely an internal GHC matter; if the team wants to structure GHC's internals with three packages, or ten, that's up to them.
158158

159159
Continuous integration
160160
======================
161161

162-
A major difficulty is **knowing when the API of 'base' (as defined in Section 2) has changed.** A change requires CLC approval; but how do we know what commits (to ``base``, to ``ghc-internals``, to ``ghc-prim``) make such a change?
162+
A major difficulty is **knowing when the API of 'base' (as defined in Section 2) has changed.** A change requires CLC approval; but how do we know what commits (to ``base``, to ``ghc-internal``, to ``ghc-prim``) make such a change?
163163

164164
In the past we have relied on best efforts; but with a bunch of volunteers, mistakes will be made.
165165
And mistakes can lead to a loss of trust.
@@ -190,43 +190,43 @@ We therefore propose the following, as part of CI:
190190
5. Develop a new suite of performance tests, specifically for base.
191191
This is quite open-ended; it is not clear what would be desirable, or how much it would cost.
192192

193-
Some modules in ``ghc-internals`` will very directly affect exports of ``base`` (e.g via shim).
193+
Some modules in ``ghc-internal`` will very directly affect exports of ``base`` (e.g via shim).
194194
These modules could be identified, via the existing ``CODEOWNERS`` mechanism, to ping CLC on any commit to those modules.
195-
This list could be selective, or include all of ``ghc-internals``, at CLC's preference.
195+
This list could be selective, or include all of ``ghc-internal``, at CLC's preference.
196196

197197
Some of these are cheap to do; others are less so.
198198
Fortunately the HF seems willing to help.
199199

200200
*But whatever we do here will be a step forward* from our current, unsatisfactory situation.
201-
Moreover, they will help with CI for changes to GHC itself! (It is rather *more* likely that a commit to GHC's simplifier will cause a perf regression in some package, than a commit to ``ghc-internals``.)
201+
Moreover, they will help with CI for changes to GHC itself! (It is rather *more* likely that a commit to GHC's simplifier will cause a perf regression in some package, than a commit to ``ghc-internal``.)
202202

203203
Discussion
204204
==========
205205

206-
Discourging the (direct) use of ``ghc-internals``
206+
Discourging the (direct) use of ``ghc-internal``
207207
-------------------------------------------------
208208

209209
.. _discourage-brainstorm:
210210

211-
Here are some ideas to be explored later for how to discorage the use of ``ghc-internals``.
211+
Here are some ideas to be explored later for how to discorage the use of ``ghc-internal``.
212212

213-
- The name ``ghc-internals`` is a pretty strong signal all by itself.
213+
- The name ``ghc-internal`` is a pretty strong signal all by itself.
214214

215215
- Cabal description and README explains how it is intended used (and not used).
216216

217-
- Hoogle could (by default anyway) never show stuff from ``ghc-internals``.
217+
- Hoogle could (by default anyway) never show stuff from ``ghc-internal``.
218218

219-
- Do not upload Haddocks for ``ghc-internals`` to Hackage.
219+
- Do not upload Haddocks for ``ghc-internal`` to Hackage.
220220
(Ditto ``ghc-prim``.) Need to make sure that if someone wants to follow the Haddock source-code link to (say) Functor, they should still find it regardless of where it is actually defined.
221221

222-
- We could consider issuing a warning if you say ``-package ghc-internals`` (or ``ghc-bignum`` or ``ghc-prim``), one that was hard to silence.
222+
- We could consider issuing a warning if you say ``-package ghc-internal`` (or ``ghc-bignum`` or ``ghc-prim``), one that was hard to silence.
223223
Since we can have module-level ``WARNING`` pragmas with custom categories, one way to realise this would be to pick a category and add such pragmas to every module in the relevant packages, though we might want to do something more systematic.
224224
The text of the warnings could encourage users to
225225

226226
- switch to a function exposed by base, and/or
227227
- petition the CLC to expose this super-useful function from base.
228228

229-
- ``cabal check`` (a per-package check) could warn on packages that use ``ghc-internals``.
229+
- ``cabal check`` (a per-package check) could warn on packages that use ``ghc-internal``.
230230

231231
GHC Proposals process
232232
---------------------
@@ -252,7 +252,7 @@ We propose that:
252252
Abstraction leakage
253253
-------------------
254254

255-
We may foresee a couple of ways in which changes in ``ghc-internals`` could become client visible:
255+
We may foresee a couple of ways in which changes in ``ghc-internal`` could become client visible:
256256

257257
- Occasionally, an error message may mention a fully qualified name for an out-of-scope identifier.
258258
For example (GHC test ``mod153``)::
@@ -264,11 +264,11 @@ We may foresee a couple of ways in which changes in ``ghc-internals`` could beco
264264
or ‘M.id’, defined at mod153.hs:2:21
265265

266266
The "originally defined in" mentions a module; and if that module is in a package that is not imported, GHC will package-qualify the module name.
267-
And seeing ``ghc-internals:GHC.Base`` is perhaps less nice.
267+
And seeing ``ghc-internal:GHC.Base`` is perhaps less nice.
268268
This is not a new problem: we already package-qualify modules in ``ghc-prim``.
269269
One solution is to remove the "originally defined in.." parenthesis for types and functions that would require such package qualification.
270270

271-
- Another form of leakage could be: a new class in ``ghc-internals``, *not exposed in base*, that is given instances for existing data types.
271+
- Another form of leakage could be: a new class in ``ghc-internal``, *not exposed in base*, that is given instances for existing data types.
272272
There is a risk that those instances might confusingly be visible to clients of ``base``.
273273
If so, the CLC should at least be consulted.
274274

@@ -279,8 +279,8 @@ They may not be show-stoppers, but we should be thoughtful about mitigating them
279279
Versions and backports
280280
----------------------
281281

282-
We agree that the version number of ``ghc-internals`` may have a major bump between minor releases of GHC.
283-
(Why? Because to fix the bug we change something in ``ghc-internals``.)
282+
We agree that the version number of ``ghc-internal`` may have a major bump between minor releases of GHC.
283+
(Why? Because to fix the bug we change something in ``ghc-internal``.)
284284

285285
This makes an exception to a general rule: generally, a minor release of GHC (say 9.6.4) which only fixes bugs, never makes a major version bump to ``base``, or indeed any boot package.
286286

@@ -318,12 +318,12 @@ Some members of the community would like to be able to upgrade/re-install the ``
318318
(For example, see `this Haskell Discourse thread <https://discourse.haskell.org/t/pre-pre-hftp-decoupling-base-and-ghc/3727>`__ and the earlier versions of now-closed `HF Proposal #47 <https://github.com/haskellfoundation/tech-proposals/pull/47>`__.)
319319
The goal of such reinstalling would be both to (a) support multiple versions of ``base`` with the same GHC, and (b) support multiple versions of GHC with the same ``base``.
320320

321-
By separating ``ghc-internals`` from ``base``, this proposal may make the reinstallable ``base`` project one step more feasible.
322-
In particular, by corralling the code that is intimately tied to a specific version of GHC in ``ghc-internals``, one might hope the code left in ``base`` would be portable across versions of GHC with no extra effort.
321+
By separating ``ghc-internal`` from ``base``, this proposal may make the reinstallable ``base`` project one step more feasible.
322+
In particular, by corralling the code that is intimately tied to a specific version of GHC in ``ghc-internal``, one might hope the code left in ``base`` would be portable across versions of GHC with no extra effort.
323323

324324
Nevertheless, *supporting reinstallable ``base`` is not a goal of this proposal*, nor is it an immediate consequence of it.
325325
There is not yet consensus that this is a goal worth pursuing.
326-
What code should be moved from ``base`` to ``ghc-internals`` is also out of scope (as described above in the proposal proper), and without knowing those details, we cannot know whether ``base`` would incidentally become more portable either.
326+
What code should be moved from ``base`` to ``ghc-internal`` is also out of scope (as described above in the proposal proper), and without knowing those details, we cannot know whether ``base`` would incidentally become more portable either.
327327

328328
Other teams to consult
329329
======================
@@ -332,7 +332,7 @@ There are other stakeholders in this space who we should consult, in addition to
332332

333333
**Stackage curators**
334334

335-
- Is it OK to make a major bump in ``ghc-internals`` for a minor release of GHC?
335+
- Is it OK to make a major bump in ``ghc-internal`` for a minor release of GHC?
336336

337337
**Haddock team**
338338

@@ -341,14 +341,14 @@ There are other stakeholders in this space who we should consult, in addition to
341341

342342
**Hackage team**
343343

344-
- Can/should we support hiding ``ghc-internals`` on Hackage?
344+
- Can/should we support hiding ``ghc-internal`` on Hackage?
345345

346346
**Security team** / **Stability working group**
347347

348-
- It might be easy for the new security-vulnerability mechanism to also flag packages that depend transitively on ``ghc-internals``.
348+
- It might be easy for the new security-vulnerability mechanism to also flag packages that depend transitively on ``ghc-internal``.
349349
If they depend on it via ``base``, this is fine.
350350
But if they depend on it via another package, this could be a hazard migrating to a newer GHC the code authors were not aware of.
351351

352352
**HLint team**
353353

354-
- Can we add a check for imports from ``ghc-internals``?
354+
- Can we add a check for imports from ``ghc-internal``?

0 commit comments

Comments
 (0)