@@ -29,6 +29,7 @@ import Development.IDE.GHC.Compat.Util
29
29
import Development.IDE.GHC.CoreFile
30
30
import Development.IDE.GHC.Util
31
31
import Development.IDE.Graph
32
+ import Development.IDE.Graph.Internal.RuleInput (Input (ProjectHaskellFile , DependencyHaskellFile , NoFile ), RuleInput )
32
33
import Development.IDE.Import.DependencyInformation
33
34
import Development.IDE.Types.HscEnvEq (HscEnvEq )
34
35
import Development.IDE.Types.KnownTargets
@@ -65,28 +66,34 @@ encodeLinkableType (Just ObjectLinkable) = "2"
65
66
66
67
-- | The parse tree for the file using GetFileContents
67
68
type instance RuleResult GetParsedModule = ParsedModule
69
+ type instance RuleInput GetParsedModule = '[ProjectHaskellFile , DependencyHaskellFile ]
68
70
69
71
-- | The parse tree for the file using GetFileContents,
70
72
-- all comments included using Opt_KeepRawTokenStream
71
73
type instance RuleResult GetParsedModuleWithComments = ParsedModule
74
+ type instance RuleInput GetParsedModuleWithComments = '[ProjectHaskellFile , DependencyHaskellFile ]
72
75
73
76
type instance RuleResult GetModuleGraph = DependencyInformation
77
+ type instance RuleInput GetModuleGraph = '[ProjectHaskellFile ]
74
78
75
79
data GetKnownTargets = GetKnownTargets
76
80
deriving (Show , Generic , Eq , Ord )
77
81
instance Hashable GetKnownTargets
78
82
instance NFData GetKnownTargets
79
83
type instance RuleResult GetKnownTargets = KnownTargets
84
+ type instance RuleInput GetKnownTargets = '[NoFile ]
80
85
81
86
-- | Convert to Core, requires TypeCheck*
82
87
type instance RuleResult GenerateCore = ModGuts
88
+ type instance RuleInput GenerateCore = '[ProjectHaskellFile ]
83
89
84
90
data GenerateCore = GenerateCore
85
91
deriving (Eq , Show , Typeable , Generic )
86
92
instance Hashable GenerateCore
87
93
instance NFData GenerateCore
88
94
89
95
type instance RuleResult GetLinkable = LinkableResult
96
+ type instance RuleInput GetLinkable = '[ProjectHaskellFile ]
90
97
91
98
data LinkableResult
92
99
= LinkableResult
@@ -112,6 +119,7 @@ instance Hashable GetImportMap
112
119
instance NFData GetImportMap
113
120
114
121
type instance RuleResult GetImportMap = ImportMap
122
+ type instance RuleInput GetImportMap = '[ProjectHaskellFile ]
115
123
newtype ImportMap = ImportMap
116
124
{ importMap :: M. Map ModuleName NormalizedFilePath -- ^ Where are the modules imported by this file located?
117
125
} deriving stock Show
@@ -232,12 +240,15 @@ instance Show HieAstResult where
232
240
233
241
-- | The type checked version of this file, requires TypeCheck+
234
242
type instance RuleResult TypeCheck = TcModuleResult
243
+ type instance RuleInput TypeCheck = '[ProjectHaskellFile ]
235
244
236
245
-- | The uncompressed HieAST
237
246
type instance RuleResult GetHieAst = HieAstResult
247
+ type instance RuleInput GetHieAst = '[ProjectHaskellFile , DependencyHaskellFile ]
238
248
239
249
-- | A IntervalMap telling us what is in scope at each point
240
250
type instance RuleResult GetBindings = Bindings
251
+ type instance RuleInput GetBindings = '[ProjectHaskellFile ]
241
252
242
253
data DocAndTyThingMap = DKMap { getDocMap :: ! DocMap , getTyThingMap :: ! TyThingMap }
243
254
instance NFData DocAndTyThingMap where
@@ -247,39 +258,50 @@ instance Show DocAndTyThingMap where
247
258
show = const " docmap"
248
259
249
260
type instance RuleResult GetDocMap = DocAndTyThingMap
261
+ type instance RuleInput GetDocMap = '[ProjectHaskellFile ]
250
262
251
263
-- | A GHC session that we reuse.
252
264
type instance RuleResult GhcSession = HscEnvEq
265
+ type instance RuleInput GhcSession = '[ProjectHaskellFile ]
253
266
254
267
-- | A GHC session preloaded with all the dependencies
255
268
-- This rule is also responsible for calling ReportImportCycles for the direct dependencies
256
269
type instance RuleResult GhcSessionDeps = HscEnvEq
270
+ type instance RuleInput GhcSessionDeps = '[ProjectHaskellFile ]
257
271
258
272
-- | Resolve the imports in a module to the file path of a module in the same package
259
273
type instance RuleResult GetLocatedImports = [(Located ModuleName , Maybe ArtifactsLocation )]
274
+ type instance RuleInput GetLocatedImports = '[ProjectHaskellFile ]
260
275
261
276
-- | This rule is used to report import cycles. It depends on GetModuleGraph.
262
277
-- We cannot report the cycles directly from GetModuleGraph since
263
278
-- we can only report diagnostics for the current file.
264
279
type instance RuleResult ReportImportCycles = ()
280
+ type instance RuleInput ReportImportCycles = '[ProjectHaskellFile ]
265
281
266
282
-- | Read the module interface file from disk. Throws an error for VFS files.
267
283
-- This is an internal rule, use 'GetModIface' instead.
268
284
type instance RuleResult GetModIfaceFromDisk = HiFileResult
285
+ type instance RuleInput GetModIfaceFromDisk = '[ProjectHaskellFile ]
269
286
270
287
-- | GetModIfaceFromDisk and index the `.hie` file into the database.
271
288
-- This is an internal rule, use 'GetModIface' instead.
272
289
type instance RuleResult GetModIfaceFromDiskAndIndex = HiFileResult
290
+ type instance RuleInput GetModIfaceFromDiskAndIndex = '[ProjectHaskellFile ]
273
291
274
292
-- | Get a module interface details, either from an interface file or a typechecked module
275
293
type instance RuleResult GetModIface = HiFileResult
294
+ type instance RuleInput GetModIface = '[ProjectHaskellFile , DependencyHaskellFile ]
276
295
277
296
-- | Get the contents of a file, either dirty (if the buffer is modified) or Nothing to mean use from disk.
278
297
type instance RuleResult GetFileContents = (FileVersion , Maybe Text )
298
+ type instance RuleInput GetFileContents = '[ProjectHaskellFile , DependencyHaskellFile ]
279
299
280
300
type instance RuleResult GetFileExists = Bool
301
+ type instance RuleInput GetFileExists = '[ProjectHaskellFile , DependencyHaskellFile ]
281
302
282
303
type instance RuleResult AddWatchedFile = Bool
304
+ type instance RuleInput AddWatchedFile = '[ProjectHaskellFile ]
283
305
284
306
285
307
-- The Shake key type for getModificationTime queries
@@ -309,6 +331,7 @@ pattern GetModificationTime = GetModificationTime_ {missingFileDiagnostics=True}
309
331
310
332
-- | Get the modification time of a file.
311
333
type instance RuleResult GetModificationTime = FileVersion
334
+ type instance RuleInput GetModificationTime = '[ProjectHaskellFile , DependencyHaskellFile ]
312
335
313
336
-- | Either the mtime from disk or an LSP version
314
337
-- LSP versions always compare as greater than on disk versions
@@ -351,6 +374,7 @@ instance Hashable IsFileOfInterestResult
351
374
instance NFData IsFileOfInterestResult
352
375
353
376
type instance RuleResult IsFileOfInterest = IsFileOfInterestResult
377
+ type instance RuleInput IsFileOfInterest = '[ProjectHaskellFile , DependencyHaskellFile ]
354
378
355
379
data ModSummaryResult = ModSummaryResult
356
380
{ msrModSummary :: ! ModSummary
@@ -373,9 +397,11 @@ instance NFData ModSummaryResult where
373
397
-- | Generate a ModSummary that has enough information to be used to get .hi and .hie files.
374
398
-- without needing to parse the entire source
375
399
type instance RuleResult GetModSummary = ModSummaryResult
400
+ type instance RuleInput GetModSummary = '[ProjectHaskellFile , DependencyHaskellFile ]
376
401
377
402
-- | Generate a ModSummary with the timestamps and preprocessed content elided, for more successful early cutoff
378
403
type instance RuleResult GetModSummaryWithoutTimestamps = ModSummaryResult
404
+ type instance RuleInput GetModSummaryWithoutTimestamps = '[ProjectHaskellFile , DependencyHaskellFile ]
379
405
380
406
data GetParsedModule = GetParsedModule
381
407
deriving (Eq , Show , Typeable , Generic )
@@ -394,6 +420,7 @@ instance NFData GetLocatedImports
394
420
395
421
-- | Does this module need to be compiled?
396
422
type instance RuleResult NeedsCompilation = Maybe LinkableType
423
+ type instance RuleInput NeedsCompilation = '[ProjectHaskellFile ]
397
424
398
425
data NeedsCompilation = NeedsCompilation
399
426
deriving (Eq , Show , Typeable , Generic )
@@ -487,6 +514,7 @@ instance Hashable GetClientSettings
487
514
instance NFData GetClientSettings
488
515
489
516
type instance RuleResult GetClientSettings = Hashed (Maybe Value )
517
+ type instance RuleInput GetClientSettings = '[ProjectHaskellFile ]
490
518
491
519
data AddWatchedFile = AddWatchedFile deriving (Eq , Show , Typeable , Generic )
492
520
instance Hashable AddWatchedFile
@@ -497,6 +525,7 @@ instance NFData AddWatchedFile
497
525
-- thread killed exception issues, so we lift it to a full rule.
498
526
-- https://github.com/digital-asset/daml/pull/2808#issuecomment-529639547
499
527
type instance RuleResult GhcSessionIO = IdeGhcSession
528
+ type instance RuleInput GhcSessionIO = '[ProjectHaskellFile ]
500
529
501
530
data IdeGhcSession = IdeGhcSession
502
531
{ loadSessionFun :: FilePath -> IO (IdeResult HscEnvEq , [FilePath ])
0 commit comments