summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-03-24 10:21:26 +0000
committerMatthew Pickering <matthewtpickering@gmail.com>2022-03-25 09:43:48 +0000
commita23f2504381a37e95b04525f774e8fb7eed5777b (patch)
treec606129efb99093fe5dd31d2fd93227d2b72e2b0
parente1ba1ba6b2aad4fbfc510919332ff39cf93338b6 (diff)
downloadhaskell-wip/t20569.tar.gz
docs: Update documentation interaction of search path, -hidir and -c mode.wip/t20569
As noted in #20569 the documentation for search path was wrong because it seemed to indicate that `-i` dirs were important when looking for interface files in `-c` mode, but they are not important if `-hidir` is set. Fixes #20569
-rw-r--r--docs/users_guide/separate_compilation.rst14
1 files changed, 9 insertions, 5 deletions
diff --git a/docs/users_guide/separate_compilation.rst b/docs/users_guide/separate_compilation.rst
index c43dcc1f2c..b10d56dc39 100644
--- a/docs/users_guide/separate_compilation.rst
+++ b/docs/users_guide/separate_compilation.rst
@@ -137,16 +137,20 @@ In your program, you import a module ``Foo`` by saying ``import Foo``.
In :ghc-flag:`--make` mode or GHCi, GHC will look for a source file for ``Foo``
and arrange to compile it first. Without :ghc-flag:`--make`, GHC will look for
the interface file for ``Foo``, which should have been created by an
-earlier compilation of ``Foo``. GHC uses the same strategy in each of
-these cases for finding the appropriate file.
+earlier compilation of ``Foo``.
-This strategy is as follows: GHC keeps a list of directories called the
+The strategy for looking for source files is as follows:
+GHC keeps a list of directories called the
search path. For each of these directories, it tries appending
``⟨basename⟩.⟨extension⟩`` to the directory, and checks whether the
file exists. The value of ⟨basename⟩ is the module name with dots
replaced by the directory separator ("``/``" or "``\\"``, depending on the
system), and ⟨extension⟩ is a source extension (``hs``, ``lhs``) if we
-are in :ghc-flag:`--make` mode or GHCi, or ⟨hisuf⟩ otherwise.
+are in :ghc-flag:`--make` mode or GHCi.
+
+When looking for interface files in :ghc-flag:`-c` mode, we look for interface
+files in the ``-hidir``, if it's set. Otherwise the same strategy as
+for source files is used to try to locate the interface file.
For example, suppose the search path contains directories ``d1``,
``d2``, and ``d3``, and we are in :ghc-flag:`--make` mode looking for the source
@@ -887,7 +891,7 @@ A hs-boot file is written in a subset of Haskell:
instance head: no superclasses, no class methods, no associated types.
However, if the class has any ::extension::`FunctionalDependencies`,
those given in the hs-boot file must be the same.
-
+
If the class declaration is given in full, the entire class declaration
must be identical, up to a renaming of the type variables bound by the
class head. This means: