A bit more documentation for unloadAll
This commit is contained in:
parent
640a91e7a9
commit
537ffc4630
@ -48,14 +48,14 @@ module System.Plugins.Env (
|
||||
|
||||
#include "../../../../config.h"
|
||||
|
||||
import System.Plugins.LoadTypes
|
||||
import System.Plugins.LoadTypes (Module)
|
||||
import System.Plugins.PackageAPI {- everything -}
|
||||
#if CABAL == 1 || __GLASGOW_HASKELL__ >= 604
|
||||
import System.Plugins.ParsePkgConfCabal( parsePkgConf )
|
||||
#else
|
||||
import System.Plugins.ParsePkgConfLite ( parsePkgConf )
|
||||
#endif
|
||||
import System.Plugins.Consts ( ghcLibraryPath, sysPkgConf, sysPkgSuffix, dllSuf )
|
||||
import System.Plugins.Consts ( ghcLibraryPath, sysPkgConf, sysPkgSuffix )
|
||||
|
||||
import Data.IORef ( writeIORef, readIORef, newIORef, IORef() )
|
||||
import Data.Maybe ( isJust, isNothing )
|
||||
@ -102,8 +102,8 @@ lookupFM = flip M.lookup
|
||||
-- safely ignore that request. We're in the IO monad anyway, so we can
|
||||
-- add some extra state of our own.
|
||||
--
|
||||
-- The state is a FiniteMap String Bool (a hash of package/object names
|
||||
-- to whether they have been loaded or not).
|
||||
-- The state is a FiniteMap String (Module,Int) (a hash of package/object names
|
||||
-- to Modules and how many times they've been loaded).
|
||||
--
|
||||
-- It also contains the package.conf information, so that if there is a
|
||||
-- package dependency we can find it correctly, even if it has a
|
||||
|
@ -289,7 +289,7 @@ dynload2 obj incpath pkgconfs sym = do
|
||||
|
||||
------------------------------------------------------------------------
|
||||
--
|
||||
-- | unload a module (not it's dependencies)
|
||||
-- | unload a module (not its dependencies)
|
||||
-- we have the dependencies, so cascaded unloading is possible
|
||||
--
|
||||
-- once you unload it, you can't 'load' it again, you have to 'reload'
|
||||
@ -298,6 +298,11 @@ dynload2 obj incpath pkgconfs sym = do
|
||||
unload :: Module -> IO ()
|
||||
unload m = rmModuleDeps m >> unloadObj m
|
||||
|
||||
------------------------------------------------------------------------
|
||||
--
|
||||
-- | unload a module and its dependencies
|
||||
-- we have the dependencies, so cascaded unloading is possible
|
||||
--
|
||||
unloadAll :: Module -> IO ()
|
||||
unloadAll m = do moduleDeps <- fmap (fromMaybe []) (getModuleDeps m)
|
||||
rmModuleDeps m
|
||||
|
Loading…
x
Reference in New Issue
Block a user