1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
module GHC.Unit.Finder.Types
( FinderCache
, FindResult (..)
, InstalledFindResult (..)
)
where
import GHC.Prelude
import GHC.Unit
import GHC.Unit.State
-- | The 'FinderCache' maps modules to the result of
-- searching for that module. It records the results of searching for
-- modules along the search path. On @:load@, we flush the entire
-- contents of this cache.
--
type FinderCache = InstalledModuleEnv InstalledFindResult
data InstalledFindResult
= InstalledFound ModLocation InstalledModule
| InstalledNoPackage UnitId
| InstalledNotFound [FilePath] (Maybe UnitId)
-- | The result of searching for an imported module.
--
-- NB: FindResult manages both user source-import lookups
-- (which can result in 'Module') as well as direct imports
-- for interfaces (which always result in 'InstalledModule').
data FindResult
= Found ModLocation Module
-- ^ The module was found
| NoPackage Unit
-- ^ The requested unit was not found
| FoundMultiple [(Module, ModuleOrigin)]
-- ^ _Error_: both in multiple packages
-- | Not found
| NotFound
{ fr_paths :: [FilePath] -- ^ Places where I looked
, fr_pkg :: Maybe Unit -- ^ Just p => module is in this unit's
-- manifest, but couldn't find the
-- .hi file
, fr_mods_hidden :: [Unit] -- ^ Module is in these units,
-- but the *module* is hidden
, fr_pkgs_hidden :: [Unit] -- ^ Module is in these units,
-- but the *unit* is hidden
-- | Module is in these units, but it is unusable
, fr_unusables :: [(Unit, UnusableUnitReason)]
, fr_suggestions :: [ModuleSuggestion] -- ^ Possible mis-spelled modules
}
|