Skip to content

Commit 480aa51

Browse files
committed
Development.IDE.Spans.Documentation: getDocumentationTryGhc: idiom
1 parent 5716fa2 commit 480aa51

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ghcide/src/Development/IDE/Spans/Documentation.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ lookupKind env mod =
6565
fmap (fromRight Nothing) . catchSrcErrors (hsc_dflags env) "span" . lookupName env mod
6666

6767
getDocumentationTryGhc :: HscEnv -> Module -> Name -> IO SpanDoc
68-
getDocumentationTryGhc env mod n = fmap head ((fmap . fmap) snd $ fmap Map.toList $ getDocumentationsTryGhc env mod [n])
68+
-- 2021-11-17: FIXME: Code uses batch search for singleton & assumes that search always succeeds.
69+
getDocumentationTryGhc env mod n = fromJust . Map.lookup n <$> getDocumentationsTryGhc env mod [n]
6970

7071
getDocumentationsTryGhc :: HscEnv -> Module -> [Name] -> IO (Map.Map Name SpanDoc)
7172
getDocumentationsTryGhc env mod names = do

0 commit comments

Comments
 (0)