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/0000-ghc-module-naming.rst
+15-7Lines changed: 15 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,11 +7,15 @@ Background and motivation
7
7
The accepted `Proposal #51: GHC base libraries <https://github.com/haskellfoundation/tech-proposals/blob/main/proposals/accepted/051-ghc-base-libraries.rst>`_
8
8
defines the following libraries:
9
9
10
-
* ``base``: the foundational library on which the rest of the ecosystem is based. Is API is carefully curated by the `Core Libraries Committee <https://github.com/haskell/core-libraries-committee>`_, and is kept rather stable.
10
+
* ``base``: the foundational library on which the rest of the ecosystem is based.
11
+
12
+
* Its API is carefully curated by the `Core Libraries Committee <https://github.com/haskell/core-libraries-committee>`_, and is kept rather stable.
11
13
12
14
* ``ghc-experimental``: the home of experimental extensions to GHC, usually ones proposed by the
* Functions and types in here are usually candidates for later transfer into ``base``. But not necessarily: if a collection of functions is not adopted widely enough, it may not be proposed for a move to `base`.
18
+
15
19
* It is user-facing (user are encouraged to depend on it), but its API is less stable than ``base``.
16
20
17
21
* ``ghc-prim, ghc-internals`` (and perhaps others): define functions and data types used internally by GHC to support the API of ``base`` and ``ghc-experimental``.
@@ -30,10 +34,11 @@ help us design module names.
30
34
The proposal
31
35
============
32
36
33
-
This proposal is split into four for easier discussion. Each sub-proposal builds on the
37
+
This proposal is split into four sub-proposals for easier discussion. Each sub-proposal builds on the
34
38
earlier ones -- they are increments, not alternatives.
35
39
36
-
The goals of this proposal are deliberately limited to establish naming conventions. We propose no new mechanisms.
40
+
The goals of this proposal are deliberately limited to establish naming conventions. We do not propose
41
+
any changes to ``ghc`` or to ``cabal``.
37
42
38
43
Proposal 1
39
44
-----------
@@ -61,9 +66,9 @@ Proposal 3
61
66
The current ``base`` API exposes many modules starting with ``GHC.*``, so the proposed conventions could only
62
67
apply to *new* modules.
63
68
64
-
* Over time, and with the agreement and support of the Core Libraries Committee, we may remove some ``GHC.*`` modules
69
+
* Over time, and only with the agreement and support of the Core Libraries Committee, we may remove some ``GHC.*`` modules
65
70
from ``base``, especially ones that are barely used, or are manifestly "internal" (i.e. part of the implementation
66
-
of other, more public functions.
71
+
of other, more public functions).
67
72
Of course there would be a significant deprecation cycle, to allow client libraries to adapt.
68
73
69
74
Proposal 3 only expresses a direction of travel. We will have to see what the CLC's attitude is,
@@ -99,6 +104,7 @@ That would have made it clear that the design of overloaded records still evolvi
99
104
Once the design becomes settled and stable, it could move to ``base``, perhaps in a module like ``Data.Records``.
100
105
101
106
Other similar examples include
107
+
102
108
* The tuple proposal of `GHC Proposal 475 <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst>`_
103
109
* The `DataToTag CLC proposal <https://github.com/haskell/core-libraries-committee/issues/104>`_ would have been easier to expose through ``ghc-experimental`` in the first instance.
104
110
@@ -109,21 +115,23 @@ Alternatives
109
115
the module moves from ``ghc-experimental`` to ``base``. For example, we might add ``Data.Tuple`` to ``ghc-experimental`` containing the new type constructors ``Tuple2``, ``Tuple3`` etc that are proposed in `GHC Proposal 475 <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst>`_. However:
110
116
111
117
* In the meantime there are two modules both called ``Data.Tuple``. This is bad. Which one does ``import Data.Tuple`` import? (Look at the Cabal file, perhaps?) How can I import both? (Package-qualified imports perhaps.) So it will really only help in the case of a brand-new module, not already in ``base``.
112
-
* It loses the explicit cue given by ``import Experimental.Data.Tuple``.
118
+
* It loses the explicit cue, in the source code, given by ``import Experimental.Data.Tuple``.
113
119
114
120
* We could use ``GHC.*`` for modules in ``ghc-experimental``, and maybe ``GHC.Internals.*`` for module in ``ghc-internals``. But
115
121
116
122
* There are two sorts of GHC-specific-ness to consider:
123
+
117
124
* Modules that are part of GHC's implementations
118
125
* Modules that support a GHC extension, blessed by the GHC Steering Committee
119
126
120
127
It is worth distinguishing these: it's confusing if both start with ``GHC.``.
121
128
122
129
* It would be a huge upheaval (with impact on users) to rename hundreds of modules in ``ghc-internals``.
123
130
124
-
* We could use ``GHC.Experimental.*`` for modules in ``ghc-experimental``. But that seems a bit backwards: ``GHC.Tuple`` (in ``ghc-internals``) would look more stable (less experimental) than ``GHC.Experimental.Tuple`` in ``ghc-experimental``; but the reverse is the case.
131
+
* We could use ``GHC.Experimental.*`` for modules in ``ghc-experimental``. But that seems a bit backwards: ``GHC.Tuple`` (in ``ghc-internals``) would superficially appear more stable (less experimental) than ``GHC.Experimental.Tuple`` in ``ghc-experimental``; but the reverse is the case.
125
132
126
133
* We could use a suffix ``*.Internals`` or ``*.Experimental`` instead of a prefix. But
134
+
127
135
* This sort of naming is conventionally used to distinguish modules *within* a package, not *between* packages.
128
136
* It would still suffer from the cost of renaming hundreds of modules in ``ghc-internals``
0 commit comments