@@ -26,7 +26,9 @@ getDocumentationTryGhc
2626 => [TypecheckedModule]
2727 -> Name
2828 -> m SpanDoc
29−#if MIN_GHC_API_VERSION(8,6,0)
29+-- getDocs goes through the GHCi codepaths which cause problems on ghc-lib.
30+-- See https://github.com/digital-asset/daml/issues/4152 for more details.
31+#if MIN_GHC_API_VERSION(8,6,0) && !defined(GHC_LIB)
3032getDocumentationTryGhc tcs name = do
3133 res <- catchSrcErrors "docs" $ getDocs name
3234 case res of
@@ -108,4 +110,4 @@ docHeaders = mapMaybe (\(L _ x) -> wrk x)
108110 AnnLineComment s -> if "-- |" `isPrefixOf` s
109111 then Just $ T.pack s
110112 else Nothing
111− _ -> Nothing
113+ _ -> Nothing