Skip to content

Commit c168ecf

Browse files
committed
Change to RST
1 parent 611babc commit c168ecf

File tree

2 files changed

+76
-69
lines changed

2 files changed

+76
-69
lines changed

proposals/0000-ghc-module-naming.md

Lines changed: 0 additions & 69 deletions
This file was deleted.

proposals/0000-ghc-module-naming.rst

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
.. sectnum::
2+
3+
# Module naming conventions for GHC base libraries
4+
5+
## Motivation
6+
7+
The accepted `Proposal #51: GHC base libraries <https://github.com/haskellfoundation/tech-proposals/blob/main/proposals/accepted/051-ghc-base-libraries.rst>`_
8+
defines the following libraries:
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.
11+
12+
* ``ghc-experimental``: the home of experimental extensions to GHC, usually ones proposed by the
13+
`GHC Steering Committee <https://github.com/ghc-proposals/ghc-proposals/>`_.
14+
Functions and types in here are usually candidates for later transfer into ``base``. It is user-facing (user are encouraged to depend on it), but its API is less stable than ``base``.
15+
16+
* ``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``.
17+
These libraries come with no stability guarantees: they may change at short notice. (They do, however, follow the PVP.)
18+
19+
The question arises of what module names should be used. For example, suppose that all three exposed a module called ``Data.Tuple``. In principle that would be fine -- GHC allows you
20+
to use the package name in the ``import`` statement, to disambiguate. But it's *extremely* confusing. This proposal articulates a set of conventions to
21+
help us design module names.
22+
23+
## The proposal
24+
25+
### Proposal 1
26+
27+
* Modules in ``base``, ``ghc-experimental``, ``ghc-prim``, ``ghc-internals`` etc should all have distinct names.
28+
29+
That principle leads immediately to the question: what should those names be? Hence proposal 2.
30+
31+
### Proposal 2
32+
33+
* Modules in GHC's internal libraries (``ghc-prim``, ``ghc-internals`` etc) should be of form ``GHC.*``.
34+
* Modules in ``ghc-experimental`` should be of form ``Experimental.*``.
35+
* Modules in ``base`` should not have either of these prefixes.
36+
37+
So example we might have
38+
* ``GHC.Tuple`` in ``ghc-internals``,
39+
* ``Experimental.Tuple`` or ``Experimental.Data.Tuple`` in ``ghc-experimental``
40+
* ``Data.Tuple`` in ``base``
41+
42+
### Proposal 3
43+
44+
The current ``base`` API exposes many modules starting with ``GHC.*``, so the proposed conventions could only
45+
apply to *new* modules.
46+
47+
* Over time, and with the agreement and support of the Core Libraries Committee, we should seek to remove ``GHC.*`` modules
48+
from ``base``, either exposing their desired API through a stable, CLC-curated, module in ``base``; or removing it altogether. Of course
49+
there would be a significant deprecation cycle, to allow client libraries to adapt.
50+
51+
### Alternatives
52+
53+
* We could use ``GHC.*`` for modules in ``ghc-experimental``, and maybe ``GHC.Internals.*`` for module in ``ghc-internals``. But
54+
55+
* There are two sorts of GHC-specific-ness to consider:
56+
* Modules that are part of GHC's implementations
57+
* Modules that support a GHC extension, blessed by the GHC Steering Committee
58+
59+
It is worth distinguishing these: it's confusing if both start with ``GHC.``.
60+
61+
* It would be a huge upheaval (with impact on users) to rename hundreds of modules in ``ghc-internals``.
62+
63+
* We could use a suffix ``*.Internals`` or ``*.Experimental`` instead of a prefix. But
64+
* This sort of naming is conventionally used to distinguish modules *within* a package, not *between* packages.
65+
* It would still suffer from the cost of renaming hundreds of modules in ``ghc-internals``
66+
67+
### Discussion
68+
69+
What should we do about the ``ghc`` package, which exposes GHC as a library, through the GHC API?
70+
It wouldn't really make sense to call it ``Experimental.*``. And yet, under the above proposals, ``GHC.*`` connotes
71+
"internal, unstable" which should not be true of the GHC API (although it is today).
72+
73+
Perhaps, as part of the GHC API redesign (a HF project in its own right) we can define modules with
74+
stable APIs, and a new prefix, such as ``GhcAPI.*``?
75+
76+

0 commit comments

Comments
 (0)