• Edward Z. Yang's avatar
    Support for using only partial pieces of included signatures. · 5f9c6d2a
    Edward Z. Yang authored
    Generally speaking, it's not possible to "hide" a requirement from a
    package you include, because if there is some module relying on that
    requirement, well, you can't just wish it out of existence.
    However, some packages don't have any modules.  For these, we can
    validly thin out requirements; indeed, this is very convenient if
    someone has published a large signature package but you only want
    some of the definitions.
    This patchset tweaks the interpretation of export lists in
    signatures: in particular, they no longer need to refer to
    entities that are defined locally; they range over both the current
    signature as well as any signatures that were inherited from
    signature packages (defined by having zero exposed modules.)
    In the process of doing this, I cleaned up a number of other
    * rnModIface and rnModExports now report errors that occurred
      during renaming and can propagate these to the TcM monad.
      This is important because in the current semantics, you can
      thin out a type which is referenced by a value you keep;
      in this situation, we need to error (to ensure that all
      types in signatures are rooted, so that we can determine
      their identities).
    * I ended up introducing a new construct 'dependency signature;
      to bkp files, to make it easier to tell if we were depending
      on a signature package.  It's not difficult for Cabal to
      figure this out (I already have a patch for it.)
    Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
    Test Plan: validate
    Reviewers: simonpj, austin, bgamari
    Subscribers: thomie, mpickering
    Differential Revision: https://phabricator.haskell.org/D2904
    GHC Trac Issues: #12994
DriverBkp.hs 33 KB