Commit 7817ec16 authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Comments only explaining the imports for GHC.Integer, GHC.Tuple

See Note [Depend on GHC.Integer]
    Note [Depend on GHC.Tuple]

This came up when Joachim got an unexpected missing-dependency
error when fiddling with Data.Coerce.
parent 56f8777f
......@@ -114,14 +114,8 @@ import GHC.Prim
import GHC.Err
import {-# SOURCE #-} GHC.IO (failIO)
-- This is not strictly speaking required by this module, but is an
-- implicit dependency whenever () or tuples are mentioned, so adding it
-- as an import here helps to get the dependencies right in the new
-- build system.
import GHC.Tuple ()
-- Likewise we need Integer when deriving things like Eq instances, and
-- this is a convenient place to force it to be built
import GHC.Integer ()
import GHC.Tuple () -- Note [Depend on GHC.Tuple]
import GHC.Integer () -- Note [Depend on GHC.Integer]
infixr 9 .
infixr 5 ++
......@@ -132,6 +126,36 @@ infixr 0 $
default () -- Double isn't available yet
\end{code}
Note [Depend on GHC.Integer]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Integer type is special because TidyPgm uses
GHC.Integer.Type.mkInteger to construct Integer literal values
Currently it reads the interface file whether or not the current
module *has* any Integer literals, so it's important that
GHC.Integer.Type (in patckage integer-gmp or integer-simple) is
compiled before any other module. (There's a hack in GHC to disable
this for packages ghc-prim, integer-gmp, integer-simple, which aren't
allowed to contain any Integer literals.)
Likewise we implicitly need Integer when deriving things like Eq
instances.
The danger is that if the build system doesn't know about the dependency
on Integer, it'll compile some base module before GHC.Integer.Type,
resulting in:
Failed to load interface for ‘GHC.Integer.Type’
There are files missing in the ‘integer-gmp’ package,
Bottom line: we make GHC.Base depend on GHC.Integer; and everything
else either depends on GHC.Base, or does not have NoImplicitPrelude
(ane hence depends on Prelude).
Note [Depend on GHC.Tuple]
~~~~~~~~~~~~~~~~~~~~~~~~~~
Similarly, tuple syntax (or ()) creates an implicit dependency on
GHC.Tuple, so we use the same ruse as for Integer --- see Note [Depend on
GHC.Integer] --- to explain this to the build system. We make GHC.Base
depend on GHC.Tuple, and everything else depends on GHC.Base or Prelude.
%*********************************************************
%* *
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment