@@ -101,6 +101,7 @@ lookupCradle :: FilePath -> GhcModuleCache -> LookupCradleResult
101
101
lookupCradle fp gmc =
102
102
lookupInCache fp gmc (const $ const ReuseCradle ) LoadCradle $ NewCradle fp
103
103
104
+ -- | Find the cradle wide 'ComponentOptions' that apply to a 'FilePath'
104
105
lookupComponentOptions
105
106
:: HasGhcModuleCache m => FilePath -> m (Maybe BIOS. ComponentOptions )
106
107
lookupComponentOptions fp = do
@@ -110,8 +111,11 @@ lookupComponentOptions fp = do
110
111
lookupInCache
111
112
:: FilePath
112
113
-> GhcModuleCache
114
+ -- | Called when file is in the current cradle
113
115
-> (BIOS. Cradle -> BIOS. ComponentOptions -> a )
116
+ -- | Called when file is a member of a cached cradle
114
117
-> (CachedCradle -> a )
118
+ -- | Default value to return is a cradle is not found
115
119
-> a
116
120
-> a
117
121
lookupInCache fp gmc cur cached def = case currentCradle gmc of
@@ -120,6 +124,7 @@ lookupInCache fp gmc cur cached def = case currentCradle gmc of
120
124
Just (_k, c, _suf) -> cached c
121
125
Nothing -> def
122
126
127
+ -- | A 'Cradle', it's 'HscEnv' and 'ComponentOptions'
123
128
data CachedCradle = CachedCradle
124
129
{ ccradle :: BIOS. Cradle
125
130
, hscEnv :: HscEnv
@@ -131,12 +136,12 @@ instance Show CachedCradle where
131
136
132
137
data GhcModuleCache = GhcModuleCache
133
138
{ cradleCache :: ! (T. Trie CachedCradle )
134
- -- ^ map from FilePath to cradles
139
+ -- ^ map from FilePath to cradle and it's config.
135
140
-- May not include currentCradle
136
141
, uriCaches :: ! UriCaches
137
142
, currentCradle :: Maybe ([FilePath ], BIOS. Cradle , BIOS. ComponentOptions )
138
- -- ^ The current cradle and which FilePath 's it is
139
- -- responsible for
143
+ -- ^ The current cradle, it 's config,
144
+ -- and which FilePath's it is responsible for.
140
145
} deriving (Show )
141
146
142
147
-- ---------------------------------------------------------------------
0 commit comments