Skip to content

Commit 0048cd8

Browse files
committed
Development.IDE.Spans.Documentation: getDocumentationsTryGhc: mv Map
1 parent bb83c28 commit 0048cd8

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,14 @@ getDocumentationsTryGhc env mod names = do
7272
res <- fun
7373
case res of
7474
Left _ -> return []
75-
Right res -> zipWithM unwrap (fmap snd $ Map.toList res) names
75+
Right res -> sequenceA $ unwrap <$> Map.toList res
7676
where
7777
fun :: IO (Either [FileDiagnostic] (Map.Map Name (Either String (Maybe HsDocString, Map.Map Int HsDocString))))
7878
fun = catchSrcErrors (hsc_dflags env) "docs" $ getDocsBatch env mod names
7979

80-
unwrap (Right (Just docs, _)) n = SpanDocString docs <$> getUris n
81-
unwrap _ n = mkSpanDocText n
82-
83-
mkSpanDocText name =
84-
SpanDocText [] <$> getUris name
80+
unwrap :: (Name, Either a (Maybe HsDocString, b)) -> IO SpanDoc
81+
unwrap (name, Right (Just docs, _)) = SpanDocString docs <$> getUris name
82+
unwrap (name, _) = SpanDocText [] <$> getUris name
8583

8684
-- Get the uris to the documentation and source html pages if they exist
8785
getUris name = do

0 commit comments

Comments
 (0)