
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 7b64697c by Mario Blažević at 2025-05-30T14:13:41-04:00 Introduce parenBreakableList and use it in ppHsContext - - - - - 10 changed files: - utils/haddock/haddock-api/resources/html/Linuwial.std-theme/linuwial.css - utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs - utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Utils.hs - utils/haddock/html-test/ref/Bug1004.html - utils/haddock/html-test/ref/Bug548.html - utils/haddock/html-test/ref/Bug973.html - utils/haddock/html-test/ref/Hash.html - utils/haddock/html-test/ref/ImplicitParams.html - utils/haddock/html-test/ref/Instances.html - utils/haddock/html-test/ref/TypeOperators.html Changes: ===================================== utils/haddock/haddock-api/resources/html/Linuwial.std-theme/linuwial.css ===================================== @@ -571,10 +571,15 @@ table.info { margin-left: 0; } +#interface span.unbreakable, #interface td.src { white-space: nowrap; } +#interface span.breakable { + white-space: pre-wrap; +} + /* @end */ /* @group Main Content */ ===================================== utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs ===================================== @@ -735,7 +735,7 @@ ppContext cxt unicode qual emptyCtxts = ppContextNoLocs (map unLoc cxt) unicode ppHsContext :: [HsType DocNameI] -> Unicode -> Qualification -> Html ppHsContext [] _ _ = noHtml ppHsContext [p] unicode qual = ppCtxType unicode qual p -ppHsContext cxt unicode qual = parenList (map (ppType unicode qual HideEmptyContexts) cxt) +ppHsContext cxt unicode qual = parenBreakableList (map (ppType unicode qual HideEmptyContexts) cxt) ------------------------------------------------------------------------------- ===================================== utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Utils.hs ===================================== @@ -29,6 +29,7 @@ module Haddock.Backends.Xhtml.Utils , pabrackets , parens , parenList + , parenBreakableList , ubxParenList , ubxSumList , arrow @@ -176,6 +177,10 @@ punctuate h (d0 : ds) = go d0 ds go d [] = [d] go d (e : es) = (d +++ h) : go e es +parenBreakableList :: [Html] -> Html +parenBreakableList = (thespan ! [theclass "breakable"]) . parens . hsep . punctuate comma + . map (thespan ! [theclass "unbreakable"]) + parenList :: [Html] -> Html parenList = parens . hsep . punctuate comma ===================================== utils/haddock/html-test/ref/Bug1004.html ===================================== @@ -304,11 +304,17 @@ ><span class="inst-left" ><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Foldable1:2" > (Foldable1 f, Foldable1 g) => (Foldable1 f, Foldable1 g) => <a href="#" title="Data.Foldable1" >Foldable1</a > (<a href="#" title="Bug1004" >Product<span class="inst-left" ><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Eq1:3" > (Eq1 f, Eq1 g) => (Eq1 f, Eq1 g) => <a href="#" title="Data.Functor.Classes" >Eq1</a > (<a href="#" title="Bug1004" >Product<span class="inst-left" ><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Ord1:4" > (Ord1 f, Ord1 g) => (Ord1 f, Ord1 g) => <a href="#" title="Data.Functor.Classes" >Ord1</a > (<a href="#" title="Bug1004" >Product<span class="inst-left" ><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Read1:5" > (Read1 f, Read1 g) => (Read1 f, Read1 g) => <a href="#" title="Data.Functor.Classes" >Read1</a > (<a href="#" title="Bug1004" >Product<span class="inst-left" ><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Show1:6" > (Show1 f, Show1 g) => (Show1 f, Show1 g) => <a href="#" title="Data.Functor.Classes" >Show1</a > (<a href="#" title="Bug1004" >Product<span class="inst-left" ><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Contravariant:7" > (Contravariant f, Contravariant g) => (Contravariant f, Contravariant g) => <a href="#" title="Data.Functor.Contravariant" >Contravariant</a > (<a href="#" title="Bug1004" >Product<span class="inst-left" ><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Alternative:8" > (Alternative f, Alternative g) => (Alternative f, Alternative g) => <a href="#" title="Control.Applicative" >Alternative</a > (<a href="#" title="Bug1004" >Product<span class="inst-left" ><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Applicative:9" > (Applicative f, Applicative g) => (Applicative f, Applicative g) => <a href="#" title="Control.Applicative" >Applicative</a > (<a href="#" title="Bug1004" >Product<span class="inst-left" ><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Functor:10" > (Functor f, Functor g) => (Functor f, Functor g) => <a href="#" title="Control.Monad" >Functor</a > (<a href="#" title="Bug1004" >Product<span class="inst-left" ><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Monad:11" > (Monad f, Monad g) => (Monad f, Monad g) => <a href="#" title="Control.Monad" >Monad</a > (<a href="#" title="Bug1004" >Product<span class="inst-left" ><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:MonadPlus:12" > (MonadPlus f, MonadPlus g) => (MonadPlus f, MonadPlus g) => <a href="#" title="Control.Monad" >MonadPlus</a > (<a href="#" title="Bug1004" >Product<span class="inst-left" ><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:MonadFix:13" > (MonadFix f, MonadFix g) => (MonadFix f, MonadFix g) => <a href="#" title="Control.Monad.Fix" >MonadFix</a > (<a href="#" title="Bug1004" >Product<span class="inst-left" ><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:MonadZip:14" > (MonadZip f, MonadZip g) => (MonadZip f, MonadZip g) => <a href="#" title="Control.Monad.Zip" >MonadZip</a > (<a href="#" title="Bug1004" >Product<span class="inst-left" ><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Foldable:15" > (Foldable f, Foldable g) => (Foldable f, Foldable g) => <a href="#" title="Data.Foldable" >Foldable</a > (<a href="#" title="Bug1004" >Product<span class="inst-left" ><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Traversable:16" > (Traversable f, Traversable g) => (Traversable f, Traversable g) => <a href="#" title="Data.Traversable" >Traversable</a > (<a href="#" title="Bug1004" >Product<span class="inst-left" ><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Monoid:17" > (Monoid (f a), Monoid (g a)) => (Monoid (f a), Monoid (g a)) => <a href="#" title="Data.Monoid" >Monoid</a > (<a href="#" title="Bug1004" >Product<span class="inst-left" ><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Semigroup:18" > (Semigroup (f a), Semigroup (g a)) => (Semigroup (f a), Semigroup (g a)) => <a href="#" title="Prelude" >Semigroup</a > (<a href="#" title="Bug1004" >Product<span class="inst-left" ><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Eq:19" > (Eq (f a), Eq (g a)) => (Eq (f a), Eq (g a)) => <a href="#" title="Data.Eq" >Eq</a > (<a href="#" title="Bug1004" >Product<span class="inst-left" ><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Ord:20" > (Ord (f a), Ord (g a)) => (Ord (f a), Ord (g a)) => <a href="#" title="Data.Ord" >Ord</a > (<a href="#" title="Bug1004" >Product<span class="inst-left" ><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Data:21" > (Typeable a, Typeable f, Typeable g, Typeable k, Data (f a), Data (g a)) => (Typeable a, Typeable f, Typeable g, Typeable k, Data (f a), Data (g a)) => <a href="#" title="Data.Data" >Data</a > (<a href="#" title="Bug1004" >ProductTypeable</a > t => (<span class="keyword" >forall d e. (Data d, Data e) => c (t d e)) -> d e. (Data d, Data e) => c (t d e)) -> <a href="#" title="Data.Maybe" >Maybe</a > (c (<a href="#" title="Bug1004" >Product<span class="inst-left" ><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Read:23" > (Read (f a), Read (g a)) => (Read (f a), Read (g a)) => <a href="#" title="Prelude" >Read</a > (<a href="#" title="Bug1004" >Product<span class="inst-left" ><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Show:24" > (Show (f a), Show (g a)) => (Show (f a), Show (g a)) => <a href="#" title="Prelude" >Show</a > (<a href="#" title="Bug1004" >Product<span class="inst-left" ><span class="instance details-toggle-control details-toggle" data-details-id="i:id:WrappedArrow:Alternative:2" > (ArrowZero a, ArrowPlus a) => (ArrowZero a, ArrowPlus a) => <a href="#" title="Control.Applicative" >Alternative</a > (<a href="#" title="Bug548" >WrappedArrow<span class="inst-left" ><span class="instance details-toggle-control details-toggle" data-details-id="i:id:WrappedArrow:Data:5" > (Typeable a, Typeable b, Typeable c, Data (a b c)) => (Typeable a, Typeable b, Typeable c, Data (a b c)) => <a href="#" title="Data.Data" >Data</a > (<a href="#" title="Bug548" >WrappedArrowTypeable</a > t => (<span class="keyword" >forall d e. (Data d, Data e) => c0 (t d e)) -> d e. (Data d, Data e) => c0 (t d e)) -> <a href="#" title="Data.Maybe" >Maybe</a > (c0 (<a href="#" title="Bug548" >WrappedArrow<li class="src short" ><a href="#" >showRead :: (Show a, Read b) => a -> b :: (Show a, Read b) => a -> b</li ><li class="src short" ><a href="#" >showRead'</a > :: <span class="keyword" >forall b a. (Show a, Read b) => a -> b b a. (Show a, Read b) => a -> b</li ></ul ></details >