
Stack implements this by passing explicit package-ids of the packages to GHC. This scheme works well for cabal projects where we know ALL the
#12518: Allow customizing immutable package dbs by stacking -------------------------------------+------------------------------------- Reporter: harendra | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Package system | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonmar): Could you give a specific example? From the description it looks like environments are exactly what you want: packages used by the project in advance. But it does not work for scripts run using runghc. In that case we do not know the packages required by the script in advance and therefore cannot pass the package-ids to GHC. That means we cannot make GHC use the packages in the right way. GHC will choose the latest version even though we want it to choose a possibly older version from the top of the db stack. Environments are designed for exactly this situation: you're using `runghc` or `ghci`, and you want `GHC` to make a specific set of packages visible. In particular, you're saying you want to deliberately use older versions of some package: you could just omit the newer versions from the environment, and GHC will ignore them. Alternatively you can specifically request the older version using a `-package` flag. One reason I'm pushing on this because I think we should deprecate the idea of DB stacks (see #12485). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12518#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler