@@ -65,21 +65,21 @@ lookupKind env mod =
65
65
fmap (fromRight Nothing ) . catchSrcErrors (hsc_dflags env) " span" . lookupName env mod
66
66
67
67
getDocumentationTryGhc :: HscEnv -> Module -> Name -> IO SpanDoc
68
- getDocumentationTryGhc env mod n = fmap head ((fmap . fmap ) snd $ getDocumentationsTryGhc env mod [n])
68
+ getDocumentationTryGhc env mod n = fmap head ((fmap . fmap ) snd $ fmap Map. toList $ getDocumentationsTryGhc env mod [n])
69
69
70
- getDocumentationsTryGhc :: HscEnv -> Module -> [Name ] -> IO [( Name , SpanDoc )]
70
+ getDocumentationsTryGhc :: HscEnv -> Module -> [Name ] -> IO ( Map. Map Name SpanDoc )
71
71
getDocumentationsTryGhc env mod names = do
72
72
res <- fun
73
73
case res of
74
- Left _ -> return []
75
- Right res -> sequenceA $ unwrap <$> Map. toList res
74
+ Left _ -> return mempty
75
+ Right res -> fmap Map. fromList $ sequenceA $ unwrap <$> Map. toList res
76
76
where
77
77
fun :: IO (Either [FileDiagnostic ] (Map. Map Name (Either String (Maybe HsDocString , Map. Map Int HsDocString ))))
78
78
fun = catchSrcErrors (hsc_dflags env) " docs" $ getDocsBatch env mod names
79
79
80
80
unwrap :: (Name , Either a (Maybe HsDocString , b )) -> IO (Name , SpanDoc )
81
81
unwrap (name, Right (Just docs, _)) = (name,) . SpanDocString docs <$> getUris name
82
- unwrap (name, _) = (name,) . SpanDocText [] <$> getUris name
82
+ unwrap (name, _) = (name,) . SpanDocText mempty <$> getUris name
83
83
84
84
-- Get the uris to the documentation and source html pages if they exist
85
85
getUris name = do
0 commit comments