Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
alexbiehl-gc
GHC
Commits
c0d27f30
Commit
c0d27f30
authored
24 years ago
by
Simon Marlow
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 2000-10-27 10:59:55 by simonmar]
fill in the package cache on the first lookup too.
parent
6c0aafc4
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ghc/compiler/main/Finder.lhs
+29
-31
29 additions, 31 deletions
ghc/compiler/main/Finder.lhs
with
29 additions
and
31 deletions
ghc/compiler/main/Finder.lhs
+
29
−
31
View file @
c0d27f30
...
...
@@ -20,7 +20,6 @@ import DriverState
import Module
import FiniteMap
import Util
import Panic
import IOExts
import Directory
...
...
@@ -49,36 +48,16 @@ newFinder (PackageConfigInfo pkgs) = do
-- expunge our home cache
writeIORef v_HomeDirCache Nothing
-- populate the package cache, if necessary
pkg_cache <- readIORef v_PkgDirCache
case pkg_cache of
Nothing -> do
let extendFM fm pkg = do
let dirs = import_dirs pkg
pkg_name = _PK_ (name pkg)
let addDir fm dir = do
contents <- getDirectoryContents' dir
return (addListToFM fm (zip contents
(repeat (pkg_name,dir))))
foldM addDir fm dirs
pkg_map <- foldM extendFM emptyFM pkgs
writeIORef v_PkgDirCache (Just pkg_map)
Just _ ->
return ()
-- and return the finder
return finder
return
(
finder
pkgs)
finder :: ModuleName -> IO (Maybe (Module, ModuleLocation))
finder name = do
finder ::
[Package] ->
ModuleName -> IO (Maybe (Module, ModuleLocation))
finder
pkgs
name = do
j <- maybeHomeModule name
case j of
Just home_module -> return (Just home_module)
Nothing -> maybePackageModule name
Nothing -> maybePackageModule
pkgs
name
maybeHomeModule :: ModuleName -> IO (Maybe (Module, ModuleLocation))
maybeHomeModule mod_name = do
...
...
@@ -136,12 +115,32 @@ mkHomeModuleLocn mod_name basename source_fn = do
}
))
maybePackageModule :: ModuleName -> IO (Maybe (Module, ModuleLocation))
maybePackageModule mod_name = do
maybePackageModule :: [Package] -> ModuleName
-> IO (Maybe (Module, ModuleLocation))
maybePackageModule pkgs mod_name = do
maybe_pkg_cache <- readIORef v_PkgDirCache
case maybe_pkg_cache of {
Nothing -> panic "maybePackageModule: no pkg_cache";
Just pkg_cache -> do
-- populate the package cache, if necessary
pkg_cache <-
case maybe_pkg_cache of
Nothing -> do
let extendFM fm pkg = do
let dirs = import_dirs pkg
pkg_name = _PK_ (name pkg)
let addDir fm dir = do
contents <- getDirectoryContents' dir
return (addListToFM fm (zip contents
(repeat (pkg_name,dir))))
foldM addDir fm dirs
pkg_map <- foldM extendFM emptyFM pkgs
writeIORef v_PkgDirCache (Just pkg_map)
return pkg_map
Just pkg_cache ->
return pkg_cache
-- hi-suffix for packages depends on the build tag.
package_hisuf <-
...
...
@@ -164,7 +163,6 @@ maybePackageModule mod_name = do
}
))
}
getDirectoryContents' d
= IO.catch (getDirectoryContents d)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment