diff options
author | Lemmih <lemmih@gmail.com> | 2006-03-27 03:09:50 +0000 |
---|---|---|
committer | Lemmih <lemmih@gmail.com> | 2006-03-27 03:09:50 +0000 |
commit | e3575292c02f1757e73922393a0aded18ca49376 (patch) | |
tree | 99f2675547a5c992db9d4d54173670422f06824c /ghc | |
parent | 2dadc32f24466e11125a1fae4f74548022fc01d7 (diff) | |
download | haskell-e3575292c02f1757e73922393a0aded18ca49376.tar.gz |
Allow users of the GHC library to specify which packages have already been loaded.
This is pretty important when using the linker/bytecode-compiler from binaries
other than GHCi.
Diffstat (limited to 'ghc')
-rw-r--r-- | ghc/compiler/ghci/Linker.lhs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/ghc/compiler/ghci/Linker.lhs b/ghc/compiler/ghci/Linker.lhs index 15786f4303..44efac8c00 100644 --- a/ghc/compiler/ghci/Linker.lhs +++ b/ghc/compiler/ghci/Linker.lhs @@ -16,7 +16,8 @@ necessary. {-# OPTIONS -optc-DNON_POSIX_SOURCE -#include "Linker.h" #-} module Linker ( HValue, showLinkerState, - linkExpr, unload, extendLinkEnv, + linkExpr, unload, extendLinkEnv, + extendLoadedPkgs, linkPackages, ) where @@ -47,7 +48,7 @@ import ErrUtils ( debugTraceMsg ) -- Standard libraries import Control.Monad ( when, filterM, foldM ) -import Data.IORef ( IORef, readIORef, writeIORef ) +import Data.IORef ( IORef, readIORef, writeIORef, modifyIORef ) import Data.List ( partition, nub ) import System.IO ( putStr, putStrLn, hPutStrLn, stderr, fixIO ) @@ -124,6 +125,10 @@ emptyPLS dflags = PersistentLinkerState { \end{code} \begin{code} +extendLoadedPkgs :: [PackageId] -> IO () +extendLoadedPkgs pkgs + = modifyIORef v_PersistentLinkerState (\s -> s{pkgs_loaded = pkgs ++ pkgs_loaded s}) + extendLinkEnv :: [(Name,HValue)] -> IO () -- Automatically discards shadowed bindings extendLinkEnv new_bindings |