on master help sign in
Clean up the Handle module (#1793)

Handle is kind of a mess at the moment, this is a first step towards cleaning it up: 1. We had two functions called getDalfDependencies with one wrapping the other. This PR merges them into one to make this less confusing. 2. buildDar called runAction a bunch of times directly and via other functions. This PR switches it to use a single call to runAction. 3. The logic for turning a Maybe into an `ExceptT [FileDiagnostic]` was duplicated in various places. This PR factor out the logic into a single function. There is certainly more cleanup to be done (e.g., I don’t think ExceptT buys us anything here, that module should probably die completely with the logic being moved to other modules, …) but I’d like to do it incrementally.

commita590e8ddbf39fc64c0b65af69ba49195a8e8b732 authorMoritz Kiefer <moritz.kiefer@purelyfunctional.org> dateFri 21 Jun 2019, 11:53 (7 years ago) parent4194dee
1 file changed+1−6
src/Development/IDE/State/Rules.hs+1−6
src/Development/IDE/State/Rules.hs+1−6
@@ -19,7 +19,6 @@ module Development.IDE.State.Rules(
1919 getAtPoint,
2020 getDefinition,
2121 getDependencies,
22− getDalfDependencies,
2322 getParsedModule,
2423 fileFromParsedModule
2524 ) where
@@ -50,7 +49,6 @@ import Development.IDE.State.RuleTypes
5049import GHC
5150import Development.IDE.Compat
5251import UniqSupply
53−import Module as M
5452import NameCache
5553
5654import qualified Development.IDE.Functions.AtPoint as AtPoint
@@ -104,10 +102,7 @@ getGhcCore file = runMaybeT $ do
104102getDependencies :: NormalizedFilePath -> Action (Maybe [NormalizedFilePath])
105103getDependencies file = fmap transitiveModuleDeps <$> use GetDependencies file
106104
107−getDalfDependencies :: NormalizedFilePath -> Action (Maybe [InstalledUnitId])
108−getDalfDependencies file = fmap transitivePkgDeps <$> use GetDependencies file
109−
110−-- | -- | Try to get hover text for the name under point.
105+-- | Try to get hover text for the name under point.
111106getAtPoint :: NormalizedFilePath -> Position -> Action (Maybe (Maybe Range, [HoverText]))
112107getAtPoint file pos = fmap join $ runMaybeT $ do
113108 files <- transitiveModuleDeps <$> useE GetDependencies file