You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: proposals/accepted/051-ghc-base-libraries.rst
+35-35Lines changed: 35 additions & 35 deletions
Original file line number
Diff line number
Diff line change
@@ -83,13 +83,13 @@ Proposal
83
83
84
84
We propose to divide ``base`` into three packages:
85
85
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.
88
88
89
89
- ``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``.
91
91
92
-
- ``ghc-experimental``, initially empty, depends on ``base`` and on ``ghc-internals``.
92
+
- ``ghc-experimental``, initially empty, depends on ``base`` and on ``ghc-internal``.
93
93
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.
94
94
Generally, new functions and types introduced in GHC Proposals would start their life here.
95
95
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.
103
103
104
104
Some observations about this structure:
105
105
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.
108
108
The specific mechanisms do not form part of this proposal, but some possibilities are `discussed in a separate section <#discourage-brainstorm>`__.
109
109
110
110
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`.
112
112
Our goal is only that naive developers should not do so by accident.
113
113
114
114
- 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:
134
134
135
135
This is going to disappear from base.
136
136
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``.
138
138
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.
142
142
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.
143
143
144
144
- 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:
153
153
154
154
- allowing the GHC Steering Committee to add new functions and types in ``ghc-experimental``.
155
155
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.
157
157
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.
158
158
159
159
Continuous integration
160
160
======================
161
161
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?
163
163
164
164
In the past we have relied on best efforts; but with a bunch of volunteers, mistakes will be made.
165
165
And mistakes can lead to a loss of trust.
@@ -190,43 +190,43 @@ We therefore propose the following, as part of CI:
190
190
5. Develop a new suite of performance tests, specifically for base.
191
191
This is quite open-ended; it is not clear what would be desirable, or how much it would cost.
192
192
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).
194
194
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.
196
196
197
197
Some of these are cheap to do; others are less so.
198
198
Fortunately the HF seems willing to help.
199
199
200
200
*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``.)
202
202
203
203
Discussion
204
204
==========
205
205
206
-
Discourging the (direct) use of ``ghc-internals``
206
+
Discourging the (direct) use of ``ghc-internal``
207
207
-------------------------------------------------
208
208
209
209
.. _discourage-brainstorm:
210
210
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``.
212
212
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.
214
214
215
215
- Cabal description and README explains how it is intended used (and not used).
216
216
217
-
- Hoogle could (by default anyway) never show stuff from ``ghc-internals``.
217
+
- Hoogle could (by default anyway) never show stuff from ``ghc-internal``.
218
218
219
-
- Do not upload Haddocks for ``ghc-internals`` to Hackage.
219
+
- Do not upload Haddocks for ``ghc-internal`` to Hackage.
220
220
(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.
221
221
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.
223
223
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.
224
224
The text of the warnings could encourage users to
225
225
226
226
- switch to a function exposed by base, and/or
227
227
- petition the CLC to expose this super-useful function from base.
228
228
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``.
230
230
231
231
GHC Proposals process
232
232
---------------------
@@ -252,7 +252,7 @@ We propose that:
252
252
Abstraction leakage
253
253
-------------------
254
254
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:
256
256
257
257
- Occasionally, an error message may mention a fully qualified name for an out-of-scope identifier.
258
258
For example (GHC test ``mod153``)::
@@ -264,11 +264,11 @@ We may foresee a couple of ways in which changes in ``ghc-internals`` could beco
264
264
or ‘M.id’, defined at mod153.hs:2:21
265
265
266
266
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.
268
268
This is not a new problem: we already package-qualify modules in ``ghc-prim``.
269
269
One solution is to remove the "originally defined in.." parenthesis for types and functions that would require such package qualification.
270
270
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.
272
272
There is a risk that those instances might confusingly be visible to clients of ``base``.
273
273
If so, the CLC should at least be consulted.
274
274
@@ -279,8 +279,8 @@ They may not be show-stoppers, but we should be thoughtful about mitigating them
279
279
Versions and backports
280
280
----------------------
281
281
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``.)
284
284
285
285
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.
286
286
@@ -318,12 +318,12 @@ Some members of the community would like to be able to upgrade/re-install the ``
318
318
(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>`__.)
319
319
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``.
320
320
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.
323
323
324
324
Nevertheless, *supporting reinstallable ``base`` is not a goal of this proposal*, nor is it an immediate consequence of it.
325
325
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.
327
327
328
328
Other teams to consult
329
329
======================
@@ -332,7 +332,7 @@ There are other stakeholders in this space who we should consult, in addition to
332
332
333
333
**Stackage curators**
334
334
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?
336
336
337
337
**Haddock team**
338
338
@@ -341,14 +341,14 @@ There are other stakeholders in this space who we should consult, in addition to
341
341
342
342
**Hackage team**
343
343
344
-
- Can/should we support hiding ``ghc-internals`` on Hackage?
344
+
- Can/should we support hiding ``ghc-internal`` on Hackage?
345
345
346
346
**Security team** / **Stability working group**
347
347
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``.
349
349
If they depend on it via ``base``, this is fine.
350
350
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.
351
351
352
352
**HLint team**
353
353
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