Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 0725e86

Browse files
committed
Add docs
1 parent 1ae19ae commit 0725e86

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

hie-plugin-api/Haskell/Ide/Engine/GhcModuleCache.hs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ lookupCradle :: FilePath -> GhcModuleCache -> LookupCradleResult
101101
lookupCradle fp gmc =
102102
lookupInCache fp gmc (const $ const ReuseCradle) LoadCradle $ NewCradle fp
103103

104+
-- | Find the cradle wide 'ComponentOptions' that apply to a 'FilePath'
104105
lookupComponentOptions
105106
:: HasGhcModuleCache m => FilePath -> m (Maybe BIOS.ComponentOptions)
106107
lookupComponentOptions fp = do
@@ -110,8 +111,11 @@ lookupComponentOptions fp = do
110111
lookupInCache
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
117121
lookupInCache 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'
123128
data CachedCradle = CachedCradle
124129
{ ccradle :: BIOS.Cradle
125130
, hscEnv :: HscEnv
@@ -131,12 +136,12 @@ instance Show CachedCradle where
131136

132137
data 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

Comments
 (0)