Skip to content
  • Michael Sloan's avatar
    Modifications to support loading GHC into GHCi · 60ecf43a
    Michael Sloan authored and Ben Gamari's avatar Ben Gamari committed
    This change was previously part of
    [D4904](https://phabricator.haskell.org/D4904), but is being split off
    to aid in getting this reviewed and merged.
    
    * The compiler code is built with `NoImplicitPrelude`, but GHCi's
      modules are incompatible with it. So, this adds the pragma to all GHCi
      modules that didn't have it, and adds imports of Prelude.
    
    * In order to run GHC within itself, a `call of 'initGCStatistics`
      needed to be skipped. This uses CPP to skip it when
      `-DGHC_LOADED_INTO_GHCI` is set.
    
    * There is an environment variable workaround suggested by Ben Gamari
      [1], where `_GHC_TOP_DIR` can be used to specify GHC's top dir if `-B`
      isn't provided.  This can be used to solve a problem where the GHC being
      run within GHCi attempts to look in `inplace/lib/lib/` instead of
      `inplace/lib/`.
    
    [1]: https://phabricator.haskell.org/D4904#135438
    
    Reviewers: goldfire, bgamari, erikd, alpmestan
    
    Reviewed By: alpmestan
    
    Subscribers: alpmestan, lelf, rwbarton, thomie, carter
    
    Differential Revision: https://phabricator.haskell.org/D4986
    60ecf43a