Skip to content

Commit c76ec9a

Browse files
committed
Fail if there are no documents to benchmark
1 parent 83fdd58 commit c76ec9a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ghcide/bench/lib/Experiments.hs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,13 @@ data DocumentPositions = DocumentPositions {
7272
doc :: !TextDocumentIdentifier
7373
}
7474

75-
allWithIdentifierPos :: Monad m => (DocumentPositions -> m Bool) -> [DocumentPositions] -> m Bool
76-
allWithIdentifierPos f docs = allM f (filter (isJust . identifierP) docs)
75+
allWithIdentifierPos :: MonadFail m => (DocumentPositions -> m Bool) -> [DocumentPositions] -> m Bool
76+
allWithIdentifierPos f docs = case applicableDocs of
77+
-- fail if there are no documents to benchmark
78+
[] -> fail "None of the example modules have identifier positions"
79+
docs' -> allM f docs'
80+
where
81+
applicableDocs = filter (isJust . identifierP) docs
7782

7883
experiments :: [Bench]
7984
experiments =

0 commit comments

Comments
 (0)