Skip to content
This repository was archived by the owner on Aug 3, 2024. It is now read-only.

Commit 49a14c8

Browse files
authored
Merge pull request #1323 from haskell/alex/backport-pl
Backport "Plugin Haddock" to GHC-9.0 branch
2 parents e90e798 + 67a3b7d commit 49a14c8

23 files changed

+643
-422
lines changed

haddock-api/haddock-api.cabal

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ library
6060
, exceptions
6161
, filepath
6262
, ghc-boot
63+
, mtl
6364
, transformers
6465

6566
hs-source-dirs: src
@@ -192,6 +193,7 @@ test-suite spec
192193
, exceptions
193194
, filepath
194195
, ghc-boot
196+
, mtl
195197
, transformers
196198

197199
build-tool-depends:

haddock-api/src/Haddock.hs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,17 @@ haddockWithGhc ghc args = handleTopExceptions $ do
152152
sinceQual <- rightOrThrowE (sinceQualification flags)
153153

154154
-- inject dynamic-too into flags before we proceed
155-
flags' <- ghc flags $ do
155+
flags'' <- ghc flags $ do
156156
df <- getDynFlags
157157
case lookup "GHC Dynamic" (compilerInfo df) of
158158
Just "YES" -> return $ Flag_OptGhc "-dynamic-too" : flags
159159
_ -> return flags
160160

161+
flags' <- pure $ case optParCount flags'' of
162+
Nothing -> flags''
163+
Just Nothing -> Flag_OptGhc "-j" : flags''
164+
Just (Just n) -> Flag_OptGhc ("-j" ++ show n) : flags''
165+
161166
-- bypass the interface version check
162167
let noChecks = Flag_BypassInterfaceVersonCheck `elem` flags
163168

haddock-api/src/Haddock/GhcUtils.hs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ import GHC.Utils.Outputable ( Outputable, panic, showPpr )
3030
import GHC.Types.Basic (PromotionFlag(..))
3131
import GHC.Types.Name
3232
import GHC.Unit.Module
33-
import GHC.Driver.Types
3433
import GHC
35-
import GHC.Core.Class
3634
import GHC.Driver.Session
3735
import GHC.Types.SrcLoc ( advanceSrcLoc )
3836
import GHC.Types.Var ( Specificity, VarBndr(..), TyVarBinder
@@ -526,14 +524,6 @@ modifySessionDynFlags f = do
526524
return ()
527525

528526

529-
-- Extract the minimal complete definition of a Name, if one exists
530-
minimalDef :: GhcMonad m => Name -> m (Maybe ClassMinimalDef)
531-
minimalDef n = do
532-
mty <- lookupGlobalName n
533-
case mty of
534-
Just (ATyCon (tyConClass_maybe -> Just c)) -> return . Just $ classMinimalDef c
535-
_ -> return Nothing
536-
537527
-------------------------------------------------------------------------------
538528
-- * DynFlags
539529
-------------------------------------------------------------------------------
@@ -766,4 +756,3 @@ defaultRuntimeRepVars = go emptyVarEnv
766756

767757
go _ ty@(LitTy {}) = ty
768758
go _ ty@(CoercionTy {}) = ty
769-

0 commit comments

Comments
 (0)