Skip to content

Commit 04ea534

Browse files
committed
refactor - move defineNoFile variants
1 parent 4bddc15 commit 04ea534

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

ghcide/src/Development/IDE/Core/Rules.hs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,16 +152,6 @@ import Control.Applicative
152152
toIdeResult :: Either [FileDiagnostic] v -> IdeResult v
153153
toIdeResult = either (, Nothing) (([],) . Just)
154154

155-
defineNoFile :: IdeRule k v => (k -> Action v) -> Rules ()
156-
defineNoFile f = defineNoDiagnostics $ \k file -> do
157-
if file == emptyFilePath then do res <- f k; return (Just res) else
158-
fail $ "Rule " ++ show k ++ " should always be called with the empty string for a file"
159-
160-
defineEarlyCutOffNoFile :: IdeRule k v => (k -> Action (BS.ByteString, v)) -> Rules ()
161-
defineEarlyCutOffNoFile f = defineEarlyCutoff $ RuleNoDiagnostics $ \k file -> do
162-
if file == emptyFilePath then do (hash, res) <- f k; return (Just hash, Just res) else
163-
fail $ "Rule " ++ show k ++ " should always be called with the empty string for a file"
164-
165155
------------------------------------------------------------
166156
-- Exposed API
167157
------------------------------------------------------------

ghcide/src/Development/IDE/Core/Shake.hs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ module Development.IDE.Core.Shake(
4444
define, defineNoDiagnostics,
4545
defineEarlyCutoff,
4646
defineOnDisk, needOnDisk, needOnDisks,
47+
defineNoFile, defineEarlyCutOffNoFile,
4748
getDiagnostics,
4849
mRunLspT, mRunLspTCallback,
4950
getHiddenDiagnostics,
@@ -833,6 +834,16 @@ defineEarlyCutoff (Rule op) = addRule $ \(Q (key, file)) (old :: Maybe BS.ByteSt
833834
defineEarlyCutoff (RuleNoDiagnostics op) = addRule $ \(Q (key, file)) (old :: Maybe BS.ByteString) mode -> otTracedAction key file isSuccess $ do
834835
defineEarlyCutoff' False key file old mode $ second (mempty,) <$> op key file
835836

837+
defineNoFile :: IdeRule k v => (k -> Action v) -> Rules ()
838+
defineNoFile f = defineNoDiagnostics $ \k file -> do
839+
if file == emptyFilePath then do res <- f k; return (Just res) else
840+
fail $ "Rule " ++ show k ++ " should always be called with the empty string for a file"
841+
842+
defineEarlyCutOffNoFile :: IdeRule k v => (k -> Action (BS.ByteString, v)) -> Rules ()
843+
defineEarlyCutOffNoFile f = defineEarlyCutoff $ RuleNoDiagnostics $ \k file -> do
844+
if file == emptyFilePath then do (hash, res) <- f k; return (Just hash, Just res) else
845+
fail $ "Rule " ++ show k ++ " should always be called with the empty string for a file"
846+
836847
defineEarlyCutoff'
837848
:: IdeRule k v
838849
=> Bool -- ^ update diagnostics

0 commit comments

Comments
 (0)