@@ -101,6 +101,7 @@ lookupCradle :: FilePath -> GhcModuleCache -> LookupCradleResult
101101lookupCradle fp gmc =
102102 lookupInCache fp gmc (const $ const ReuseCradle ) LoadCradle $ NewCradle fp
103103
104+ -- | Find the cradle wide 'ComponentOptions' that apply to a 'FilePath'
104105lookupComponentOptions
105106 :: HasGhcModuleCache m => FilePath -> m (Maybe BIOS. ComponentOptions )
106107lookupComponentOptions fp = do
@@ -110,8 +111,11 @@ lookupComponentOptions fp = do
110111lookupInCache
111112 :: FilePath
112113 -> GhcModuleCache
114+ -- | Called when file is in the current cradle
113115 -> (BIOS. Cradle -> BIOS. ComponentOptions -> a )
116+ -- | Called when file is a member of a cached cradle
114117 -> (CachedCradle -> a )
118+ -- | Default value to return is a cradle is not found
115119 -> a
116120 -> a
117121lookupInCache fp gmc cur cached def = case currentCradle gmc of
@@ -120,6 +124,7 @@ lookupInCache fp gmc cur cached def = case currentCradle gmc of
120124 Just (_k, c, _suf) -> cached c
121125 Nothing -> def
122126
127+ -- | A 'Cradle', it's 'HscEnv' and 'ComponentOptions'
123128data CachedCradle = CachedCradle
124129 { ccradle :: BIOS. Cradle
125130 , hscEnv :: HscEnv
@@ -131,12 +136,12 @@ instance Show CachedCradle where
131136
132137data GhcModuleCache = GhcModuleCache
133138 { cradleCache :: ! (T. Trie CachedCradle )
134- -- ^ map from FilePath to cradles
139+ -- ^ map from FilePath to cradle and it's config.
135140 -- May not include currentCradle
136141 , uriCaches :: ! UriCaches
137142 , 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.
140145 } deriving (Show )
141146
142147-- ---------------------------------------------------------------------
0 commit comments