[Git][ghc/ghc][wip/T25705-1] 2 commits: template-haskell: Add explicit exports lists to all remaining modules

Teo Camarasu (@teo) gitlab at gitlab.haskell.org
Thu Mar 6 12:27:47 UTC 2025



Teo Camarasu pushed to branch wip/T25705-1 at Glasgow Haskell Compiler / GHC


Commits:
08b8ae6f by Teo Camarasu at 2025-03-06T12:27:36+00:00
template-haskell: Add explicit exports lists to all remaining modules

- - - - -
3c629d1f by Teo Camarasu at 2025-03-06T12:27:36+00:00
template-haskell: fix haddocks

It seems that we need a direct dependency on ghc-internal, otherwise
Haddock cannot find our haddocks

Resolves #25705

- - - - -


7 changed files:

- libraries/template-haskell/Language/Haskell/TH/Ppr.hs
- libraries/template-haskell/Language/Haskell/TH/PprLib.hs
- libraries/template-haskell/Language/Haskell/TH/Syntax.hs
- libraries/template-haskell/template-haskell.cabal.in
- utils/haddock/html-test/ref/QuasiExpr.html
- utils/haddock/html-test/ref/TH.html
- utils/haddock/html-test/ref/Threaded_TH.html


Changes:

=====================================
libraries/template-haskell/Language/Haskell/TH/Ppr.hs
=====================================
@@ -1,9 +1,91 @@
 {-# LANGUAGE Safe #-}
 
--- | contains a prettyprinter for the
--- Template Haskell datatypes
-module Language.Haskell.TH.Ppr
-  ( module GHC.Boot.TH.Ppr )
-  where
+{- | contains a prettyprinter for the
+Template Haskell datatypes
+-}
+module Language.Haskell.TH.Ppr (
+    appPrec,
+    bar,
+    bytesToString,
+    commaSep,
+    commaSepApplied,
+    commaSepWith,
+    fromTANormal,
+    funPrec,
+    hashParens,
+    isStarT,
+    isSymOcc,
+    nestDepth,
+    noPrec,
+    opPrec,
+    parensIf,
+    pprBangType,
+    pprBndrVis,
+    pprBody,
+    pprClause,
+    pprCtxWith,
+    pprCxt,
+    pprExp,
+    pprFields,
+    pprFixity,
+    pprForall,
+    pprForall',
+    pprForallVis,
+    pprFunArgType,
+    pprGadtRHS,
+    pprGuarded,
+    pprInfixExp,
+    pprInfixT,
+    pprLit,
+    pprMatchPat,
+    pprMaybeExp,
+    pprNamespaceSpecifier,
+    pprParendType,
+    pprParendTypeArg,
+    pprPat,
+    pprPatSynSig,
+    pprPatSynType,
+    pprPrefixOcc,
+    pprRecFields,
+    pprStrictType,
+    pprString,
+    pprTyApp,
+    pprTyLit,
+    pprType,
+    pprVarBangType,
+    pprVarStrictType,
+    ppr_bndrs,
+    ppr_ctx_preds_with,
+    ppr_cxt_preds,
+    ppr_data,
+    ppr_dec,
+    ppr_deriv_clause,
+    ppr_deriv_strategy,
+    ppr_newtype,
+    ppr_overlap,
+    ppr_sig,
+    ppr_tf_head,
+    ppr_tySyn,
+    ppr_type_data,
+    ppr_typedef,
+    pprint,
+    qualPrec,
+    quoteParens,
+    semiSep,
+    semiSepWith,
+    sepWith,
+    showtextl,
+    sigPrec,
+    split,
+    unboxedSumBars,
+    unopPrec,
+    where_clause,
+    ForallVisFlag (..),
+    Ppr (..),
+    PprFlag (..),
+    Precedence,
+    TypeArg (..),
+)
+where
 
 import GHC.Boot.TH.Ppr


=====================================
libraries/template-haskell/Language/Haskell/TH/PprLib.hs
=====================================
@@ -1,8 +1,56 @@
 {-# LANGUAGE Safe #-}
 
 -- | Monadic front-end to Text.PrettyPrint
-module Language.Haskell.TH.PprLib
-  ( module GHC.Boot.TH.PprLib )
-  where
+module Language.Haskell.TH.PprLib (
+    ($$),
+    ($+$),
+    (<+>),
+    (<>),
+    arrow,
+    braces,
+    brackets,
+    cat,
+    char,
+    colon,
+    comma,
+    dcolon,
+    double,
+    doubleQuotes,
+    empty,
+    equals,
+    fcat,
+    float,
+    fsep,
+    hang,
+    hcat,
+    hsep,
+    int,
+    integer,
+    isEmpty,
+    lbrace,
+    lbrack,
+    lparen,
+    nest,
+    parens,
+    pprName,
+    pprName',
+    ptext,
+    punctuate,
+    quotes,
+    rational,
+    rbrace,
+    rbrack,
+    rparen,
+    semi,
+    sep,
+    space,
+    text,
+    to_HPJ_Doc,
+    vcat,
+    Doc,
+    PprM,
+)
+where
 
+import Prelude hiding ((<>))
 import GHC.Boot.TH.PprLib


=====================================
libraries/template-haskell/Language/Haskell/TH/Syntax.hs
=====================================
@@ -1,22 +1,206 @@
 {-# LANGUAGE MagicHash #-}
-{-# LANGUAGE UnboxedTuples #-}
 {-# LANGUAGE TemplateHaskellQuotes #-}
 {-# LANGUAGE Trustworthy #-}
-module Language.Haskell.TH.Syntax
-  ( module GHC.Boot.TH.Syntax
-  , makeRelativeToProject
-  , module GHC.Boot.TH.Lift
-  , addrToByteArrayName
-  , addrToByteArray
-  )
+{-# LANGUAGE UnboxedTuples #-}
+
+module Language.Haskell.TH.Syntax (
+    Quote (..),
+    Exp (..),
+    Match (..),
+    Clause (..),
+    Q (..),
+    Pat (..),
+    Stmt (..),
+    Con (..),
+    Type (..),
+    Dec (..),
+    BangType,
+    VarBangType,
+    FieldExp,
+    FieldPat,
+    Name (..),
+    FunDep (..),
+    Pred,
+    RuleBndr (..),
+    TySynEqn (..),
+    InjectivityAnn (..),
+    Kind,
+    Overlap (..),
+    DerivClause (..),
+    DerivStrategy (..),
+    Code (..),
+    ModName (..),
+    addCorePlugin,
+    addDependentFile,
+    addForeignFile,
+    addForeignFilePath,
+    addForeignSource,
+    addModFinalizer,
+    addTempFile,
+    addTopDecls,
+    badIO,
+    bindCode,
+    bindCode_,
+    cmpEq,
+    compareBytes,
+    counter,
+    defaultFixity,
+    eqBytes,
+    extsEnabled,
+    getDoc,
+    getPackageRoot,
+    getQ,
+    get_cons_names,
+    hoistCode,
+    isExtEnabled,
+    isInstance,
+    joinCode,
+    liftCode,
+    location,
+    lookupName,
+    lookupTypeName,
+    lookupValueName,
+    manyName,
+    maxPrecedence,
+    memcmp,
+    mkNameG,
+    mkNameU,
+    mkOccName,
+    mkPkgName,
+    mk_tup_name,
+    mkName,
+    mkNameG_v,
+    mkNameG_d,
+    mkNameG_tc,
+    mkNameL,
+    mkNameS,
+    unTypeCode,
+    mkModName,
+    unsafeCodeCoerce,
+    mkNameQ,
+    mkNameG_fld,
+    modString,
+    nameBase,
+    nameModule,
+    namePackage,
+    nameSpace,
+    newDeclarationGroup,
+    newNameIO,
+    occString,
+    oneName,
+    pkgString,
+    putDoc,
+    putQ,
+    recover,
+    reify,
+    reifyAnnotations,
+    reifyConStrictness,
+    reifyFixity,
+    reifyInstances,
+    reifyModule,
+    reifyRoles,
+    reifyType,
+    report,
+    reportError,
+    reportWarning,
+    runIO,
+    sequenceQ,
+    runQ,
+    showName,
+    showName',
+    thenCmp,
+    tupleDataName,
+    tupleTypeName,
+    unTypeQ,
+    unboxedSumDataName,
+    unboxedSumTypeName,
+    unboxedTupleDataName,
+    unboxedTupleTypeName,
+    unsafeTExpCoerce,
+    ForeignSrcLang (..),
+    Extension (..),
+    AnnLookup (..),
+    AnnTarget (..),
+    Arity,
+    Bang (..),
+    BndrVis (..),
+    Body (..),
+    Bytes (..),
+    Callconv (..),
+    CharPos,
+    Cxt,
+    DecidedStrictness (..),
+    DocLoc (..),
+    FamilyResultSig (..),
+    Fixity (..),
+    FixityDirection (..),
+    Foreign (..),
+    Guard (..),
+    Info (..),
+    Inline (..),
+    InstanceDec,
+    Lit (..),
+    Loc (..),
+    Module (..),
+    ModuleInfo (..),
+    NameFlavour (..),
+    NameIs (..),
+    NameSpace (..),
+    NamespaceSpecifier (..),
+    OccName (..),
+    ParentName,
+    PatSynArgs (..),
+    PatSynDir (..),
+    PatSynType,
+    Phases (..),
+    PkgName (..),
+    Pragma (..),
+    Quasi (..),
+    Range (..),
+    Role (..),
+    RuleMatch (..),
+    Safety (..),
+    SourceStrictness (..),
+    SourceUnpackedness (..),
+    Specificity (..),
+    Strict,
+    StrictType,
+    SumAlt,
+    SumArity,
+    TExp (..),
+    TyLit (..),
+    TyVarBndr (..),
+    TypeFamilyHead (..),
+    Uniq,
+    Unlifted,
+    VarStrictType,
+    makeRelativeToProject,
+    liftString,
+    Lift (..),
+    dataToCodeQ,
+    dataToExpQ,
+    dataToPatQ,
+    dataToQa,
+    falseName,
+    justName,
+    leftName,
+    liftData,
+    liftDataTyped,
+    nonemptyName,
+    nothingName,
+    rightName,
+    trueName,
+    addrToByteArrayName,
+    addrToByteArray,
+)
 where
 
-import GHC.Boot.TH.Syntax
-import GHC.Boot.TH.Lift
-import System.FilePath
 import Data.Array.Byte
+import GHC.Boot.TH.Lift
+import GHC.Boot.TH.Syntax
 import GHC.Exts
 import GHC.ST
+import System.FilePath
 
 -- This module completely re-exports 'GHC.Boot.TH.Syntax',
 -- and exports additionally functions that depend on filepath.
@@ -41,4 +225,3 @@ addrToByteArray (I# len) addr = runST $ ST $
     (# s', mb #) -> case copyAddrToByteArray# addr mb 0# len s' of
       s'' -> case unsafeFreezeByteArray# mb s'' of
         (# s''', ret #) -> (# s''', ByteArray ret #)
-


=====================================
libraries/template-haskell/template-haskell.cabal.in
=====================================
@@ -53,6 +53,10 @@ Library
 
     build-depends:
         base        >= 4.11 && < 4.22,
+        -- We don't directly depend on any of the modules from `ghc-internal`
+        -- But we need to depend on it to work around a Haddock bug.
+        -- See: https://gitlab.haskell.org/ghc/ghc/-/issues/25705
+        ghc-internal == @ProjectVersionForLib at .*,
         ghc-boot-th == @ProjectVersionMunged@
 
     other-modules:


=====================================
utils/haddock/html-test/ref/QuasiExpr.html
=====================================
@@ -335,9 +335,9 @@
 	    >parseExprExp</a
 	    > :: <a href="#" title="Data.String"
 	    >String</a
-	    > -> <a href="#" title="Language.Haskell.TH"
+	    > -> <a href="#" title="Language.Haskell.TH.Syntax"
 	    >Q</a
-	    > <a href="#" title="Language.Haskell.TH"
+	    > <a href="#" title="Language.Haskell.TH.Syntax"
 	    >Exp</a
 	    > <a href="#" class="selflink"
 	    >#</a


=====================================
utils/haddock/html-test/ref/TH.html
=====================================
@@ -55,9 +55,9 @@
 	><p class="src"
 	  ><a id="v:decl" class="def"
 	    >decl</a
-	    > :: <a href="#" title="Language.Haskell.TH"
+	    > :: <a href="#" title="Language.Haskell.TH.Syntax"
 	    >Q</a
-	    > [<a href="#" title="Language.Haskell.TH"
+	    > [<a href="#" title="Language.Haskell.TH.Syntax"
 	    >Dec</a
 	    >] <a href="#" class="selflink"
 	    >#</a


=====================================
utils/haddock/html-test/ref/Threaded_TH.html
=====================================
@@ -67,9 +67,9 @@
 	  ><li class="src short"
 	    ><a href="#"
 	      >forkTH</a
-	      > :: <a href="#" title="Language.Haskell.TH"
+	      > :: <a href="#" title="Language.Haskell.TH.Syntax"
 	      >Q</a
-	      > <a href="#" title="Language.Haskell.TH"
+	      > <a href="#" title="Language.Haskell.TH.Syntax"
 	      >Exp</a
 	      ></li
 	    ></ul
@@ -82,9 +82,9 @@
 	><p class="src"
 	  ><a id="v:forkTH" class="def"
 	    >forkTH</a
-	    > :: <a href="#" title="Language.Haskell.TH"
+	    > :: <a href="#" title="Language.Haskell.TH.Syntax"
 	    >Q</a
-	    > <a href="#" title="Language.Haskell.TH"
+	    > <a href="#" title="Language.Haskell.TH.Syntax"
 	    >Exp</a
 	    > <a href="#" class="selflink"
 	    >#</a



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/57c25aca5f5371d5ff05a67d113e814c27b551f3...3c629d1f4dbb41d38c227ee80e0f35c9aaabd653

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/57c25aca5f5371d5ff05a67d113e814c27b551f3...3c629d1f4dbb41d38c227ee80e0f35c9aaabd653
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20250306/fed9e76d/attachment-0001.html>


More information about the ghc-commits mailing list