| ... |
... |
@@ -1641,3 +1641,44 @@ using the :ghc-flag:`--show-iface ⟨file⟩` :ref:`mode <modes>`. If there is a |
|
1641
|
1641
|
|
|
1642
|
1642
|
.. [1]
|
|
1643
|
1643
|
This is a change in behaviour relative to 6.2 and earlier.
|
|
|
1644
|
+
|
|
|
1645
|
+
|
|
|
1646
|
+.. _known-key-names
|
|
|
1647
|
+
|
|
|
1648
|
+Known-key names
|
|
|
1649
|
+----------------------------------------
|
|
|
1650
|
+
|
|
|
1651
|
+(This section is relevant only if you are a GHC developer, or you are
|
|
|
1652
|
+modifying the ``base`` package.)
|
|
|
1653
|
+
|
|
|
1654
|
+GHC relies on a few hundred entities (types, classes, and functions)
|
|
|
1655
|
+defined in the libraries ``ghc-internal`` or ``base``. These include the classes
|
|
|
1656
|
+``Num``, ``Show``, etc, the types ``Rational``, ``Ratio`` etc, and much
|
|
|
1657
|
+more. These entities have so-called "known-key" names.
|
|
|
1658
|
+
|
|
|
1659
|
+You can read ``Note [Overview of known-key names]`` in GHC's source code
|
|
|
1660
|
+to understand more. The behaviour of known-key names is controlled by two
|
|
|
1661
|
+flags:
|
|
|
1662
|
+
|
|
|
1663
|
+.. ghc-flag:: -frebindable-known-key-names
|
|
|
1664
|
+ :shortdesc: Find known-key names in the current top-level scope
|
|
|
1665
|
+ :type: dynamic
|
|
|
1666
|
+ :category:
|
|
|
1667
|
+
|
|
|
1668
|
+ This flag is off by default. It is typically set when compiling modules
|
|
|
1669
|
+ in ``ghc-internal`` or ``base``, and tells GHC to look for a known-key
|
|
|
1670
|
+ entity in the current top-level scope. When the flag is un-set, GHC looks
|
|
|
1671
|
+ for the module ``base:GHC.KnownKeyNames``, but this module does not exist
|
|
|
1672
|
+ when compiling ``ghc-internal`` or ``base``, which is why the flag is needed.
|
|
|
1673
|
+
|
|
|
1674
|
+.. ghc-flag:: -fdefines-known-key-names
|
|
|
1675
|
+ :shortdesc: This module defines a known-key name
|
|
|
1676
|
+ :type: dynamic
|
|
|
1677
|
+ :category:
|
|
|
1678
|
+
|
|
|
1679
|
+ This flag is off by default. It should be set when compiling a module
|
|
|
1680
|
+ that *defines* a known-key entity. That is how GHC knows that the entity
|
|
|
1681
|
+ called "Rational" in this module is *the* known-key ``Rational`` and not
|
|
|
1682
|
+ some other random type or class that happens to be called "Rational".
|
|
|
1683
|
+
|
|
|
1684
|
+ |