
[Git][ghc/ghc][wip/fail-with-hascallstack] 3 commits: haddock: Fix links to type operators
by Bodigrim (@Bodigrim) 31 May '25
by Bodigrim (@Bodigrim) 31 May '25
31 May '25
Bodigrim pushed to branch wip/fail-with-hascallstack at Glasgow Haskell Compiler / GHC
Commits:
a0adc30d by Ryan Hendrickson at 2025-05-30T14:12:52-04:00
haddock: Fix links to type operators
- - - - -
7b64697c by Mario Blažević at 2025-05-30T14:13:41-04:00
Introduce parenBreakableList and use it in ppHsContext
- - - - -
2a7f3468 by Andrew Lelechenko at 2025-05-31T17:44:42+03:00
Add HasCallStack to Control.Monad.Fail.fail
CLC proposal https://github.com/haskell/core-libraries-committee/issues/327
2% compile-time allocations increase in T3064, likely because `fail`
is now marginally more expensive to compile.
Metric Increase:
T3064
- - - - -
31 changed files:
- libraries/base/changelog.md
- libraries/base/tests/IO/withBinaryFile002.stderr
- libraries/base/tests/IO/withFile002.stderr
- libraries/base/tests/IO/withFileBlocking002.stderr
- libraries/ghc-internal/src/GHC/Internal/Control/Monad/Fail.hs
- libraries/ghc-internal/src/GHC/Internal/Exception/Type.hs-boot
- libraries/ghc-internal/src/GHC/Internal/IO.hs-boot
- libraries/ghc-internal/src/GHC/Internal/IO/Exception.hs-boot
- testsuite/tests/deSugar/should_run/DsDoExprFailMsg.stderr
- testsuite/tests/deSugar/should_run/DsMonadCompFailMsg.stderr
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
- testsuite/tests/interface-stability/base-exports.stdout-mingw32
- testsuite/tests/interface-stability/base-exports.stdout-ws-32
- testsuite/tests/th/T15321.stderr
- testsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.stderr
- testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr
- 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/haddock-api/src/Haddock/Interface/LexParseRn.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/PatternSyns.html
- utils/haddock/html-test/ref/TypeOperators.html
- utils/haddock/html-test/src/TypeOperators.hs
- utils/haddock/hypsrc-test/ref/src/Quasiquoter.html
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/70b33397ad350ba74fe2343a69dad7…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/70b33397ad350ba74fe2343a69dad7…
You're receiving this email because of your account on gitlab.haskell.org.
1
0

[Git][ghc/ghc][wip/fail-with-hascallstack] Add HasCallStack to Control.Monad.Fail.fail
by Bodigrim (@Bodigrim) 31 May '25
by Bodigrim (@Bodigrim) 31 May '25
31 May '25
Bodigrim pushed to branch wip/fail-with-hascallstack at Glasgow Haskell Compiler / GHC
Commits:
70b33397 by Andrew Lelechenko at 2025-05-31T15:08:07+03:00
Add HasCallStack to Control.Monad.Fail.fail
CLC proposal https://github.com/haskell/core-libraries-committee/issues/327
2% compile-time allocations increase in T3064, likely because `fail`
is now marginally more expensive to compile.
Metric Increase:
T3064
- - - - -
18 changed files:
- libraries/base/changelog.md
- libraries/base/tests/IO/withBinaryFile002.stderr
- libraries/base/tests/IO/withFile002.stderr
- libraries/base/tests/IO/withFileBlocking002.stderr
- libraries/ghc-internal/src/GHC/Internal/Control/Monad/Fail.hs
- libraries/ghc-internal/src/GHC/Internal/Exception/Type.hs-boot
- libraries/ghc-internal/src/GHC/Internal/IO.hs-boot
- libraries/ghc-internal/src/GHC/Internal/IO/Exception.hs-boot
- testsuite/tests/deSugar/should_run/DsDoExprFailMsg.stderr
- testsuite/tests/deSugar/should_run/DsMonadCompFailMsg.stderr
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
- testsuite/tests/interface-stability/base-exports.stdout-mingw32
- testsuite/tests/interface-stability/base-exports.stdout-ws-32
- testsuite/tests/th/T15321.stderr
- testsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.stderr
- testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr
- utils/haddock/hypsrc-test/ref/src/Quasiquoter.html
Changes:
=====================================
libraries/base/changelog.md
=====================================
@@ -9,6 +9,7 @@
* `Data.List.NonEmpty.{init,last,tails1}` are now defined using only total functions (rather than partial ones). ([CLC proposal #293](https://github.com/haskell/core-libraries-committee/issues/293))
* `Data.List.NonEmpty` functions now have the same laziness as their `Data.List` counterparts (i.e. make them more strict than they currently are) ([CLC proposal #107](https://github.com/haskell/core-libraries-committee/issues/107))
* `instance Functor NonEmpty` is now specified using `map` (rather than duplicating code). ([CLC proposal #300](https://github.com/haskell/core-libraries-committee/issues/300))
+ * `fail` from `MonadFail` now carries `HasCallStack` constraint. ([CLC proposal #327](https://github.com/haskell/core-libraries-committee/issues/327))
* The `Data.Enum.enumerate` function was introduced ([CLC #306](https://github.com/haskell/core-libraries-committee/issues/306))
* Worker threads used by various `base` facilities are now labelled with descriptive thread labels ([CLC proposal #305](https://github.com/haskell/core-libraries-committee/issues/305), [GHC #25452](https://gitlab.haskell.org/ghc/ghc/-/issues/25452)). Specifically, these include:
* `Control.Concurrent.threadWaitRead`
=====================================
libraries/base/tests/IO/withBinaryFile002.stderr
=====================================
@@ -1,3 +1,9 @@
withBinaryFile002: Uncaught exception ghc-internal:GHC.Internal.IO.Exception.IOException:
user error (test)
+
+HasCallStack backtrace:
+ throwIO, called at libraries/ghc-internal/src/GHC/Internal/Control/Monad/Fail.hs:66:12 in ghc-internal:GHC.Internal.Control.Monad.Fail
+ a type signature in an instance, called at libraries/ghc-internal/src/GHC/Internal/Control/Monad/Fail.hs:65:13 in ghc-internal:GHC.Internal.Control.Monad.Fail
+ fail, called at withBinaryFile002.hs:8:5 in main:Main
+
=====================================
libraries/base/tests/IO/withFile002.stderr
=====================================
@@ -1,3 +1,9 @@
withFile002: Uncaught exception ghc-internal:GHC.Internal.IO.Exception.IOException:
user error (test)
+
+HasCallStack backtrace:
+ throwIO, called at libraries/ghc-internal/src/GHC/Internal/Control/Monad/Fail.hs:66:12 in ghc-internal:GHC.Internal.Control.Monad.Fail
+ a type signature in an instance, called at libraries/ghc-internal/src/GHC/Internal/Control/Monad/Fail.hs:65:13 in ghc-internal:GHC.Internal.Control.Monad.Fail
+ fail, called at withFile002.hs:8:5 in main:Main
+
=====================================
libraries/base/tests/IO/withFileBlocking002.stderr
=====================================
@@ -1,3 +1,9 @@
withFileBlocking002: Uncaught exception ghc-internal:GHC.Internal.IO.Exception.IOException:
user error (test)
+
+HasCallStack backtrace:
+ throwIO, called at libraries/ghc-internal/src/GHC/Internal/Control/Monad/Fail.hs:66:12 in ghc-internal:GHC.Internal.Control.Monad.Fail
+ a type signature in an instance, called at libraries/ghc-internal/src/GHC/Internal/Control/Monad/Fail.hs:65:13 in ghc-internal:GHC.Internal.Control.Monad.Fail
+ fail, called at withFileBlocking002.hs:9:5 in main:Main
+
=====================================
libraries/ghc-internal/src/GHC/Internal/Control/Monad/Fail.hs
=====================================
@@ -1,3 +1,4 @@
+{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE NoImplicitPrelude #-}
@@ -13,7 +14,10 @@
--
module GHC.Internal.Control.Monad.Fail ( MonadFail(fail) ) where
-import GHC.Internal.Base (String, Monad(), Maybe(Nothing), IO(), failIO)
+import GHC.Internal.Base (String, Monad(), Maybe(Nothing), IO(), (.))
+import {-# SOURCE #-} GHC.Internal.IO (throwIO)
+import {-# SOURCE #-} GHC.Internal.IO.Exception (userError)
+import GHC.Internal.Stack.Types (HasCallStack)
-- | When a value is bound in @do@-notation, the pattern on the left
-- hand side of @<-@ might not match. In this case, this class
@@ -42,18 +46,21 @@ import GHC.Internal.Base (String, Monad(), Maybe(Nothing), IO(), failIO)
--
-- @since base-4.9.0.0
class Monad m => MonadFail m where
- fail :: String -> m a
+ fail :: HasCallStack => String -> m a
-- | @since base-4.9.0.0
instance MonadFail Maybe where
+ fail :: HasCallStack => String -> Maybe a
fail _ = Nothing
-- | @since base-4.9.0.0
instance MonadFail [] where
{-# INLINE fail #-}
+ fail :: HasCallStack => String -> [a]
fail _ = []
-- | @since base-4.9.0.0
instance MonadFail IO where
- fail = failIO
+ fail :: HasCallStack => String -> IO a
+ fail = throwIO . userError
=====================================
libraries/ghc-internal/src/GHC/Internal/Exception/Type.hs-boot
=====================================
@@ -2,7 +2,8 @@
{-# LANGUAGE NoImplicitPrelude #-}
module GHC.Internal.Exception.Type
- ( SomeException
+ ( Exception
+ , SomeException
, divZeroException
, overflowException
, ratioZeroDenomException
@@ -12,6 +13,8 @@ module GHC.Internal.Exception.Type
-- See W1 of Note [Tracking dependencies on primitives] in GHC.Internal.Base
import GHC.Internal.Types ()
+class Exception e
+
data SomeException
divZeroException, overflowException,
ratioZeroDenomException, underflowException :: SomeException
=====================================
libraries/ghc-internal/src/GHC/Internal/IO.hs-boot
=====================================
@@ -3,8 +3,10 @@
module GHC.Internal.IO where
+import GHC.Internal.Stack.Types (HasCallStack)
import GHC.Internal.Types
-import {-# SOURCE #-} GHC.Internal.Exception.Type (SomeException)
+import {-# SOURCE #-} GHC.Internal.Exception.Type (Exception, SomeException)
mplusIO :: IO a -> IO a -> IO a
mkUserError :: [Char] -> SomeException
+throwIO :: (HasCallStack, Exception e) => e -> IO a
=====================================
libraries/ghc-internal/src/GHC/Internal/IO/Exception.hs-boot
=====================================
@@ -4,7 +4,7 @@
module GHC.Internal.IO.Exception where
import GHC.Internal.Base
-import GHC.Internal.Exception
+import {-# SOURCE #-} GHC.Internal.Exception.Type
data IOException
instance Exception IOException
=====================================
testsuite/tests/deSugar/should_run/DsDoExprFailMsg.stderr
=====================================
@@ -1,3 +1,9 @@
DsDoExprFailMsg: Uncaught exception ghc-internal:GHC.Internal.IO.Exception.IOException:
user error (Pattern match failure in 'do' block at DsDoExprFailMsg.hs:2:3-8)
+
+HasCallStack backtrace:
+ throwIO, called at libraries/ghc-internal/src/GHC/Internal/Control/Monad/Fail.hs:66:12 in ghc-internal:GHC.Internal.Control.Monad.Fail
+ a type signature in an instance, called at libraries/ghc-internal/src/GHC/Internal/Control/Monad/Fail.hs:65:13 in ghc-internal:GHC.Internal.Control.Monad.Fail
+ a do statement, called at DsDoExprFailMsg.hs:2:3 in main:Main
+
=====================================
testsuite/tests/deSugar/should_run/DsMonadCompFailMsg.stderr
=====================================
@@ -1,3 +1,9 @@
DsMonadCompFailMsg: Uncaught exception ghc-internal:GHC.Internal.IO.Exception.IOException:
user error (Pattern match failure in monad comprehension at DsMonadCompFailMsg.hs:2:14-19)
+
+HasCallStack backtrace:
+ throwIO, called at libraries/ghc-internal/src/GHC/Internal/Control/Monad/Fail.hs:66:12 in ghc-internal:GHC.Internal.Control.Monad.Fail
+ a type signature in an instance, called at libraries/ghc-internal/src/GHC/Internal/Control/Monad/Fail.hs:65:13 in ghc-internal:GHC.Internal.Control.Monad.Fail
+ a monad comprehension pattern, called at DsMonadCompFailMsg.hs:2:14 in main:Main
+
=====================================
testsuite/tests/interface-stability/base-exports.stdout
=====================================
@@ -452,7 +452,7 @@ module Control.Monad where
{-# MINIMAL (>>=) #-}
type MonadFail :: (* -> *) -> Constraint
class Monad m => MonadFail m where
- fail :: forall a. GHC.Internal.Base.String -> m a
+ fail :: forall a. GHC.Internal.Stack.Types.HasCallStack => GHC.Internal.Base.String -> m a
{-# MINIMAL fail #-}
type MonadPlus :: (* -> *) -> Constraint
class (GHC.Internal.Base.Alternative m, Monad m) => MonadPlus m where
@@ -492,7 +492,7 @@ module Control.Monad.Fail where
-- Safety: Safe
type MonadFail :: (* -> *) -> Constraint
class GHC.Internal.Base.Monad m => MonadFail m where
- fail :: forall a. GHC.Internal.Base.String -> m a
+ fail :: forall a. GHC.Internal.Stack.Types.HasCallStack => GHC.Internal.Base.String -> m a
{-# MINIMAL fail #-}
module Control.Monad.Fix where
@@ -9991,7 +9991,7 @@ module Prelude where
{-# MINIMAL (>>=) #-}
type MonadFail :: (* -> *) -> Constraint
class Monad m => MonadFail m where
- fail :: forall a. String -> m a
+ fail :: forall a. GHC.Internal.Stack.Types.HasCallStack => String -> m a
{-# MINIMAL fail #-}
type Monoid :: * -> Constraint
class Semigroup a => Monoid a where
=====================================
testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
=====================================
@@ -452,7 +452,7 @@ module Control.Monad where
{-# MINIMAL (>>=) #-}
type MonadFail :: (* -> *) -> Constraint
class Monad m => MonadFail m where
- fail :: forall a. GHC.Internal.Base.String -> m a
+ fail :: forall a. GHC.Internal.Stack.Types.HasCallStack => GHC.Internal.Base.String -> m a
{-# MINIMAL fail #-}
type MonadPlus :: (* -> *) -> Constraint
class (GHC.Internal.Base.Alternative m, Monad m) => MonadPlus m where
@@ -492,7 +492,7 @@ module Control.Monad.Fail where
-- Safety: Safe
type MonadFail :: (* -> *) -> Constraint
class GHC.Internal.Base.Monad m => MonadFail m where
- fail :: forall a. GHC.Internal.Base.String -> m a
+ fail :: forall a. GHC.Internal.Stack.Types.HasCallStack => GHC.Internal.Base.String -> m a
{-# MINIMAL fail #-}
module Control.Monad.Fix where
=====================================
testsuite/tests/interface-stability/base-exports.stdout-mingw32
=====================================
@@ -452,7 +452,7 @@ module Control.Monad where
{-# MINIMAL (>>=) #-}
type MonadFail :: (* -> *) -> Constraint
class Monad m => MonadFail m where
- fail :: forall a. GHC.Internal.Base.String -> m a
+ fail :: forall a. GHC.Internal.Stack.Types.HasCallStack => GHC.Internal.Base.String -> m a
{-# MINIMAL fail #-}
type MonadPlus :: (* -> *) -> Constraint
class (GHC.Internal.Base.Alternative m, Monad m) => MonadPlus m where
@@ -492,7 +492,7 @@ module Control.Monad.Fail where
-- Safety: Safe
type MonadFail :: (* -> *) -> Constraint
class GHC.Internal.Base.Monad m => MonadFail m where
- fail :: forall a. GHC.Internal.Base.String -> m a
+ fail :: forall a. GHC.Internal.Stack.Types.HasCallStack => GHC.Internal.Base.String -> m a
{-# MINIMAL fail #-}
module Control.Monad.Fix where
=====================================
testsuite/tests/interface-stability/base-exports.stdout-ws-32
=====================================
@@ -452,7 +452,7 @@ module Control.Monad where
{-# MINIMAL (>>=) #-}
type MonadFail :: (* -> *) -> Constraint
class Monad m => MonadFail m where
- fail :: forall a. GHC.Internal.Base.String -> m a
+ fail :: forall a. GHC.Internal.Stack.Types.HasCallStack => GHC.Internal.Base.String -> m a
{-# MINIMAL fail #-}
type MonadPlus :: (* -> *) -> Constraint
class (GHC.Internal.Base.Alternative m, Monad m) => MonadPlus m where
@@ -492,7 +492,7 @@ module Control.Monad.Fail where
-- Safety: Safe
type MonadFail :: (* -> *) -> Constraint
class GHC.Internal.Base.Monad m => MonadFail m where
- fail :: forall a. GHC.Internal.Base.String -> m a
+ fail :: forall a. GHC.Internal.Stack.Types.HasCallStack => GHC.Internal.Base.String -> m a
{-# MINIMAL fail #-}
module Control.Monad.Fix where
=====================================
testsuite/tests/th/T15321.stderr
=====================================
@@ -3,7 +3,9 @@ T15321.hs:9:9: error: [GHC-88464]
• In the expression: _ "baz"
In the untyped splice: $(_ "baz")
• Valid hole fits include
- fail :: forall (m :: * -> *) a. MonadFail m => String -> m a
+ fail :: forall (m :: * -> *) a.
+ (MonadFail m, GHC.Internal.Stack.Types.HasCallStack) =>
+ String -> m a
with fail @GHC.Internal.TH.Syntax.Q @GHC.Internal.TH.Syntax.Exp
(imported from ‘Prelude’ at T15321.hs:3:8-13
(and originally defined in ‘GHC.Internal.Control.Monad.Fail’))
=====================================
testsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.stderr
=====================================
@@ -1,4 +1,3 @@
-
subsumption_sort_hole_fits.hs:2:5: warning: [GHC-88464] [-Wtyped-holes (in -Wdefault)]
• Found hole: _ :: String -> [String]
• In the expression: _ "hello, world"
@@ -24,7 +23,9 @@ subsumption_sort_hole_fits.hs:2:5: warning: [GHC-88464] [-Wtyped-holes (in -Wdef
with mempty @(String -> [String])
(imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1
(and originally defined in ‘GHC.Internal.Base’))
- fail :: forall (m :: * -> *) a. MonadFail m => String -> m a
+ fail :: forall (m :: * -> *) a.
+ (MonadFail m, GHC.Internal.Stack.Types.HasCallStack) =>
+ String -> m a
with fail @[] @String
(imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1
(and originally defined in ‘GHC.Internal.Control.Monad.Fail’))
@@ -36,3 +37,4 @@ subsumption_sort_hole_fits.hs:2:5: warning: [GHC-88464] [-Wtyped-holes (in -Wdef
with pure @[] @String
(imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1
(and originally defined in ‘GHC.Internal.Base’))
+
=====================================
testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr
=====================================
@@ -247,7 +247,9 @@ valid_hole_fits.hs:41:8: warning: [GHC-88464] [-Wtyped-holes (in -Wdefault)]
with print @String
(imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
(and originally defined in ‘GHC.Internal.System.IO’))
- fail :: forall (m :: * -> *) a. MonadFail m => String -> m a
+ fail :: forall (m :: * -> *) a.
+ (MonadFail m, GHC.Internal.Stack.Types.HasCallStack) =>
+ String -> m a
with fail @IO @()
(imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40
(and originally defined in ‘GHC.Internal.Control.Monad.Fail’))
=====================================
utils/haddock/hypsrc-test/ref/src/Quasiquoter.html
=====================================
@@ -405,8 +405,10 @@ forall a. String -> Q a
><span class="annot"
><span class="annottext"
>String -> Q a
-forall a. String -> Q a
-forall (m :: * -> *) a. MonadFail m => String -> m a
+forall a. HasCallStack => String -> Q a
+forall (m :: * -> *) a.
+(MonadFail m, HasCallStack) =>
+String -> m a
</span
><span class="hs-identifier hs-var"
>fail</span
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/70b33397ad350ba74fe2343a69dad7d…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/70b33397ad350ba74fe2343a69dad7d…
You're receiving this email because of your account on gitlab.haskell.org.
1
0

30 May '25
Bodigrim pushed new branch wip/fail-with-hascallstack at Glasgow Haskell Compiler / GHC
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/fail-with-hascallstack
You're receiving this email because of your account on gitlab.haskell.org.
1
0

[Git][ghc/ghc][master] Introduce parenBreakableList and use it in ppHsContext
by Marge Bot (@marge-bot) 30 May '25
by Marge Bot (@marge-bot) 30 May '25
30 May '25
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"
></span
- > (<a href="#" title="Data.Foldable1"
- >Foldable1</a
- > f, <a href="#" title="Data.Foldable1"
- >Foldable1</a
- > g) => <a href="#" title="Data.Foldable1"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Foldable1"
+ >Foldable1</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Foldable1"
+ >Foldable1</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Data.Foldable1"
>Foldable1</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -459,11 +465,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Eq1:3"
></span
- > (<a href="#" title="Data.Functor.Classes"
- >Eq1</a
- > f, <a href="#" title="Data.Functor.Classes"
- >Eq1</a
- > g) => <a href="#" title="Data.Functor.Classes"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Functor.Classes"
+ >Eq1</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Functor.Classes"
+ >Eq1</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Data.Functor.Classes"
>Eq1</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -513,11 +525,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Ord1:4"
></span
- > (<a href="#" title="Data.Functor.Classes"
- >Ord1</a
- > f, <a href="#" title="Data.Functor.Classes"
- >Ord1</a
- > g) => <a href="#" title="Data.Functor.Classes"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Functor.Classes"
+ >Ord1</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Functor.Classes"
+ >Ord1</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Data.Functor.Classes"
>Ord1</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -567,11 +585,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Read1:5"
></span
- > (<a href="#" title="Data.Functor.Classes"
- >Read1</a
- > f, <a href="#" title="Data.Functor.Classes"
- >Read1</a
- > g) => <a href="#" title="Data.Functor.Classes"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Functor.Classes"
+ >Read1</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Functor.Classes"
+ >Read1</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Data.Functor.Classes"
>Read1</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -669,11 +693,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Show1:6"
></span
- > (<a href="#" title="Data.Functor.Classes"
- >Show1</a
- > f, <a href="#" title="Data.Functor.Classes"
- >Show1</a
- > g) => <a href="#" title="Data.Functor.Classes"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Functor.Classes"
+ >Show1</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Functor.Classes"
+ >Show1</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Data.Functor.Classes"
>Show1</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -743,11 +773,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Contravariant:7"
></span
- > (<a href="#" title="Data.Functor.Contravariant"
- >Contravariant</a
- > f, <a href="#" title="Data.Functor.Contravariant"
- >Contravariant</a
- > g) => <a href="#" title="Data.Functor.Contravariant"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Functor.Contravariant"
+ >Contravariant</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Functor.Contravariant"
+ >Contravariant</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Data.Functor.Contravariant"
>Contravariant</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -799,11 +835,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Alternative:8"
></span
- > (<a href="#" title="Control.Applicative"
- >Alternative</a
- > f, <a href="#" title="Control.Applicative"
- >Alternative</a
- > g) => <a href="#" title="Control.Applicative"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Control.Applicative"
+ >Alternative</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Control.Applicative"
+ >Alternative</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Control.Applicative"
>Alternative</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -879,11 +921,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Applicative:9"
></span
- > (<a href="#" title="Control.Applicative"
- >Applicative</a
- > f, <a href="#" title="Control.Applicative"
- >Applicative</a
- > g) => <a href="#" title="Control.Applicative"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Control.Applicative"
+ >Applicative</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Control.Applicative"
+ >Applicative</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Control.Applicative"
>Applicative</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -975,11 +1023,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Functor:10"
></span
- > (<a href="#" title="Control.Monad"
- >Functor</a
- > f, <a href="#" title="Control.Monad"
- >Functor</a
- > g) => <a href="#" title="Control.Monad"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Control.Monad"
+ >Functor</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Control.Monad"
+ >Functor</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Control.Monad"
>Functor</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -1035,11 +1089,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Monad:11"
></span
- > (<a href="#" title="Control.Monad"
- >Monad</a
- > f, <a href="#" title="Control.Monad"
- >Monad</a
- > g) => <a href="#" title="Control.Monad"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Control.Monad"
+ >Monad</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Control.Monad"
+ >Monad</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Control.Monad"
>Monad</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -1107,11 +1167,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:MonadPlus:12"
></span
- > (<a href="#" title="Control.Monad"
- >MonadPlus</a
- > f, <a href="#" title="Control.Monad"
- >MonadPlus</a
- > g) => <a href="#" title="Control.Monad"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Control.Monad"
+ >MonadPlus</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Control.Monad"
+ >MonadPlus</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Control.Monad"
>MonadPlus</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -1167,11 +1233,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:MonadFix:13"
></span
- > (<a href="#" title="Control.Monad.Fix"
- >MonadFix</a
- > f, <a href="#" title="Control.Monad.Fix"
- >MonadFix</a
- > g) => <a href="#" title="Control.Monad.Fix"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Control.Monad.Fix"
+ >MonadFix</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Control.Monad.Fix"
+ >MonadFix</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Control.Monad.Fix"
>MonadFix</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -1217,11 +1289,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:MonadZip:14"
></span
- > (<a href="#" title="Control.Monad.Zip"
- >MonadZip</a
- > f, <a href="#" title="Control.Monad.Zip"
- >MonadZip</a
- > g) => <a href="#" title="Control.Monad.Zip"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Control.Monad.Zip"
+ >MonadZip</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Control.Monad.Zip"
+ >MonadZip</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Control.Monad.Zip"
>MonadZip</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -1293,11 +1371,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Foldable:15"
></span
- > (<a href="#" title="Data.Foldable"
- >Foldable</a
- > f, <a href="#" title="Data.Foldable"
- >Foldable</a
- > g) => <a href="#" title="Data.Foldable"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Foldable"
+ >Foldable</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Foldable"
+ >Foldable</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Data.Foldable"
>Foldable</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -1491,11 +1575,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Traversable:16"
></span
- > (<a href="#" title="Data.Traversable"
- >Traversable</a
- > f, <a href="#" title="Data.Traversable"
- >Traversable</a
- > g) => <a href="#" title="Data.Traversable"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Traversable"
+ >Traversable</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Traversable"
+ >Traversable</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Data.Traversable"
>Traversable</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -1579,11 +1669,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Monoid:17"
></span
- > (<a href="#" title="Data.Monoid"
- >Monoid</a
- > (f a), <a href="#" title="Data.Monoid"
- >Monoid</a
- > (g a)) => <a href="#" title="Data.Monoid"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Monoid"
+ >Monoid</a
+ > (f a)</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Monoid"
+ >Monoid</a
+ > (g a)</span
+ >)</span
+ > => <a href="#" title="Data.Monoid"
>Monoid</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -1649,11 +1745,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Semigroup:18"
></span
- > (<a href="#" title="Prelude"
- >Semigroup</a
- > (f a), <a href="#" title="Prelude"
- >Semigroup</a
- > (g a)) => <a href="#" title="Prelude"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Semigroup</a
+ > (f a)</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Semigroup</a
+ > (g a)</span
+ >)</span
+ > => <a href="#" title="Prelude"
>Semigroup</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -1725,11 +1827,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Eq:19"
></span
- > (<a href="#" title="Data.Eq"
- >Eq</a
- > (f a), <a href="#" title="Data.Eq"
- >Eq</a
- > (g a)) => <a href="#" title="Data.Eq"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Eq"
+ >Eq</a
+ > (f a)</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Eq"
+ >Eq</a
+ > (g a)</span
+ >)</span
+ > => <a href="#" title="Data.Eq"
>Eq</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -1789,11 +1897,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Ord:20"
></span
- > (<a href="#" title="Data.Ord"
- >Ord</a
- > (f a), <a href="#" title="Data.Ord"
- >Ord</a
- > (g a)) => <a href="#" title="Data.Ord"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Ord"
+ >Ord</a
+ > (f a)</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Ord"
+ >Ord</a
+ > (g a)</span
+ >)</span
+ > => <a href="#" title="Data.Ord"
>Ord</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -1913,19 +2027,33 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Data:21"
></span
- > (<a href="#" title="Data.Dynamic"
- >Typeable</a
- > a, <a href="#" title="Data.Dynamic"
- >Typeable</a
- > f, <a href="#" title="Data.Dynamic"
- >Typeable</a
- > g, <a href="#" title="Data.Dynamic"
- >Typeable</a
- > k, <a href="#" title="Data.Data"
- >Data</a
- > (f a), <a href="#" title="Data.Data"
- >Data</a
- > (g a)) => <a href="#" title="Data.Data"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Dynamic"
+ >Typeable</a
+ > a</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Dynamic"
+ >Typeable</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Dynamic"
+ >Typeable</a
+ > g</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Dynamic"
+ >Typeable</a
+ > k</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Data"
+ >Data</a
+ > (f a)</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Data"
+ >Data</a
+ > (g a)</span
+ >)</span
+ > => <a href="#" title="Data.Data"
>Data</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -2027,11 +2155,17 @@
>Typeable</a
> t => (<span class="keyword"
>forall</span
- > d e. (<a href="#" title="Data.Data"
- >Data</a
- > d, <a href="#" title="Data.Data"
- >Data</a
- > e) => c (t d e)) -> <a href="#" title="Data.Maybe"
+ > d e. <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Data"
+ >Data</a
+ > d</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Data"
+ >Data</a
+ > e</span
+ >)</span
+ > => c (t d e)) -> <a href="#" title="Data.Maybe"
>Maybe</a
> (c (<a href="#" title="Bug1004"
>Product</a
@@ -2315,11 +2449,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Read:23"
></span
- > (<a href="#" title="Prelude"
- >Read</a
- > (f a), <a href="#" title="Prelude"
- >Read</a
- > (g a)) => <a href="#" title="Prelude"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Read</a
+ > (f a)</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Read</a
+ > (g a)</span
+ >)</span
+ > => <a href="#" title="Prelude"
>Read</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -2397,11 +2537,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Show:24"
></span
- > (<a href="#" title="Prelude"
- >Show</a
- > (f a), <a href="#" title="Prelude"
- >Show</a
- > (g a)) => <a href="#" title="Prelude"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Show</a
+ > (f a)</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Show</a
+ > (g a)</span
+ >)</span
+ > => <a href="#" title="Prelude"
>Show</a
> (<a href="#" title="Bug1004"
>Product</a
=====================================
utils/haddock/html-test/ref/Bug548.html
=====================================
@@ -252,11 +252,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:WrappedArrow:Alternative:2"
></span
- > (<a href="#" title="Control.Arrow"
- >ArrowZero</a
- > a, <a href="#" title="Control.Arrow"
- >ArrowPlus</a
- > a) => <a href="#" title="Control.Applicative"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Control.Arrow"
+ >ArrowZero</a
+ > a</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Control.Arrow"
+ >ArrowPlus</a
+ > a</span
+ >)</span
+ > => <a href="#" title="Control.Applicative"
>Alternative</a
> (<a href="#" title="Bug548"
>WrappedArrow</a
@@ -484,15 +490,25 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:WrappedArrow:Data:5"
></span
- > (<a href="#" title="Data.Dynamic"
- >Typeable</a
- > a, <a href="#" title="Data.Dynamic"
- >Typeable</a
- > b, <a href="#" title="Data.Dynamic"
- >Typeable</a
- > c, <a href="#" title="Data.Data"
- >Data</a
- > (a b c)) => <a href="#" title="Data.Data"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Dynamic"
+ >Typeable</a
+ > a</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Dynamic"
+ >Typeable</a
+ > b</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Dynamic"
+ >Typeable</a
+ > c</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Data"
+ >Data</a
+ > (a b c)</span
+ >)</span
+ > => <a href="#" title="Data.Data"
>Data</a
> (<a href="#" title="Bug548"
>WrappedArrow</a
@@ -594,11 +610,17 @@
>Typeable</a
> t => (<span class="keyword"
>forall</span
- > d e. (<a href="#" title="Data.Data"
- >Data</a
- > d, <a href="#" title="Data.Data"
- >Data</a
- > e) => c0 (t d e)) -> <a href="#" title="Data.Maybe"
+ > d e. <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Data"
+ >Data</a
+ > d</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Data"
+ >Data</a
+ > e</span
+ >)</span
+ > => c0 (t d e)) -> <a href="#" title="Data.Maybe"
>Maybe</a
> (c0 (<a href="#" title="Bug548"
>WrappedArrow</a
=====================================
utils/haddock/html-test/ref/Bug973.html
=====================================
@@ -56,21 +56,33 @@
><li class="src short"
><a href="#"
>showRead</a
- > :: (<a href="#" title="Prelude"
- >Show</a
- > a, <a href="#" title="Prelude"
- >Read</a
- > b) => a -> b</li
+ > :: <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Show</a
+ > a</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Read</a
+ > b</span
+ >)</span
+ > => a -> b</li
><li class="src short"
><a href="#"
>showRead'</a
> :: <span class="keyword"
>forall</span
- > b a. (<a href="#" title="Prelude"
- >Show</a
- > a, <a href="#" title="Prelude"
- >Read</a
- > b) => a -> b</li
+ > b a. <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Show</a
+ > a</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Read</a
+ > b</span
+ >)</span
+ > => a -> b</li
></ul
></details
></div
@@ -90,11 +102,17 @@
><table
><tr
><td class="src"
- >:: (<a href="#" title="Prelude"
- >Show</a
- > a, <a href="#" title="Prelude"
- >Read</a
- > b)</td
+ >:: <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Show</a
+ > a</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Read</a
+ > b</span
+ >)</span
+ ></td
><td class="doc empty"
> </td
></tr
@@ -132,11 +150,17 @@
><td class="src"
>:: <span class="keyword"
>forall</span
- > b a. (<a href="#" title="Prelude"
- >Show</a
- > a, <a href="#" title="Prelude"
- >Read</a
- > b)</td
+ > b a. <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Show</a
+ > a</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Read</a
+ > b</span
+ >)</span
+ ></td
><td class="doc empty"
> </td
></tr
=====================================
utils/haddock/html-test/ref/Hash.html
=====================================
@@ -99,11 +99,17 @@
><li class="src short"
><a href="#"
>new</a
- > :: (<a href="#" title="Data.Eq"
- >Eq</a
- > key, <a href="#" title="Hash"
- >Hash</a
- > key) => <a href="#" title="Data.Int"
+ > :: <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Eq"
+ >Eq</a
+ > key</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Hash"
+ >Hash</a
+ > key</span
+ >)</span
+ > => <a href="#" title="Data.Int"
>Int</a
> -> <a href="#" title="Prelude"
>IO</a
@@ -113,11 +119,17 @@
><li class="src short"
><a href="#"
>insert</a
- > :: (<a href="#" title="Data.Eq"
- >Eq</a
- > key, <a href="#" title="Hash"
- >Hash</a
- > key) => key -> val -> <a href="#" title="Prelude"
+ > :: <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Eq"
+ >Eq</a
+ > key</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Hash"
+ >Hash</a
+ > key</span
+ >)</span
+ > => key -> val -> <a href="#" title="Prelude"
>IO</a
> ()</li
><li class="src short"
@@ -191,11 +203,17 @@
><p class="src"
><a id="v:new" class="def"
>new</a
- > :: (<a href="#" title="Data.Eq"
- >Eq</a
- > key, <a href="#" title="Hash"
- >Hash</a
- > key) => <a href="#" title="Data.Int"
+ > :: <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Eq"
+ >Eq</a
+ > key</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Hash"
+ >Hash</a
+ > key</span
+ >)</span
+ > => <a href="#" title="Data.Int"
>Int</a
> -> <a href="#" title="Prelude"
>IO</a
@@ -213,11 +231,17 @@
><p class="src"
><a id="v:insert" class="def"
>insert</a
- > :: (<a href="#" title="Data.Eq"
- >Eq</a
- > key, <a href="#" title="Hash"
- >Hash</a
- > key) => key -> val -> <a href="#" title="Prelude"
+ > :: <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Eq"
+ >Eq</a
+ > key</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Hash"
+ >Hash</a
+ > key</span
+ >)</span
+ > => key -> val -> <a href="#" title="Prelude"
>IO</a
> () <a href="#" class="selflink"
>#</a
@@ -395,11 +419,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:ic:Hash:Hash:3"
></span
- > (<a href="#" title="Hash"
- >Hash</a
- > a, <a href="#" title="Hash"
- >Hash</a
- > b) => <a href="#" title="Hash"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Hash"
+ >Hash</a
+ > a</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Hash"
+ >Hash</a
+ > b</span
+ >)</span
+ > => <a href="#" title="Hash"
>Hash</a
> (a, b)</span
> <a href="#" class="selflink"
=====================================
utils/haddock/html-test/ref/ImplicitParams.html
=====================================
@@ -91,11 +91,17 @@
><p class="src"
><a id="v:d" class="def"
>d</a
- > :: (?x :: <a href="#" title="ImplicitParams"
- >X</a
- >, ?y :: <a href="#" title="ImplicitParams"
- >X</a
- >) => (<a href="#" title="ImplicitParams"
+ > :: <span class="breakable"
+ >(<span class="unbreakable"
+ >?x :: <a href="#" title="ImplicitParams"
+ >X</a
+ ></span
+ >, <span class="unbreakable"
+ >?y :: <a href="#" title="ImplicitParams"
+ >X</a
+ ></span
+ >)</span
+ > => (<a href="#" title="ImplicitParams"
>X</a
>, <a href="#" title="ImplicitParams"
>X</a
=====================================
utils/haddock/html-test/ref/Instances.html
=====================================
@@ -438,11 +438,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:ic:Foo:Foo:5"
></span
- > (<a href="#" title="Data.Eq"
- >Eq</a
- > a, <a href="#" title="Instances"
- >Foo</a
- > f) => <a href="#" title="Instances"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Eq"
+ >Eq</a
+ > a</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Instances"
+ >Foo</a
+ > f</span
+ >)</span
+ > => <a href="#" title="Instances"
>Foo</a
> ((,) (f a))</span
> <a href="#" class="selflink"
=====================================
utils/haddock/html-test/ref/TypeOperators.html
=====================================
@@ -215,11 +215,17 @@
><p class="src"
><a id="v:g" class="def"
>g</a
- > :: (a <a href="#" title="Data.Type.Equality"
- >~</a
- > b, b <a href="#" title="Data.Type.Equality"
- >~</a
- > c) => a -> c <a href="#" class="selflink"
+ > :: <span class="breakable"
+ >(<span class="unbreakable"
+ >a <a href="#" title="Data.Type.Equality"
+ >~</a
+ > b</span
+ >, <span class="unbreakable"
+ >b <a href="#" title="Data.Type.Equality"
+ >~</a
+ > c</span
+ >)</span
+ > => a -> c <a href="#" class="selflink"
>#</a
></p
></div
@@ -241,13 +247,19 @@
><p class="src"
><a id="v:y" class="def"
>y</a
- > :: (a <a href="#" title="TypeOperators"
- ><=></a
- > a, <a href="#" title="TypeOperators"
- >Op</a
- > a a <a href="#" title="TypeOperators"
- ><=></a
- > a) => a <a href="#" class="selflink"
+ > :: <span class="breakable"
+ >(<span class="unbreakable"
+ >a <a href="#" title="TypeOperators"
+ ><=></a
+ > a</span
+ >, <span class="unbreakable"
+ ><a href="#" title="TypeOperators"
+ >Op</a
+ > a a <a href="#" title="TypeOperators"
+ ><=></a
+ > a</span
+ >)</span
+ > => a <a href="#" class="selflink"
>#</a
></p
></div
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7b64697c12fb3054067c98c41d6d264…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7b64697c12fb3054067c98c41d6d264…
You're receiving this email because of your account on gitlab.haskell.org.
1
0

30 May '25
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
a0adc30d by Ryan Hendrickson at 2025-05-30T14:12:52-04:00
haddock: Fix links to type operators
- - - - -
4 changed files:
- utils/haddock/haddock-api/src/Haddock/Interface/LexParseRn.hs
- utils/haddock/html-test/ref/PatternSyns.html
- utils/haddock/html-test/ref/TypeOperators.html
- utils/haddock/html-test/src/TypeOperators.hs
Changes:
=====================================
utils/haddock/haddock-api/src/Haddock/Interface/LexParseRn.hs
=====================================
@@ -155,6 +155,7 @@ rename sDocContext renamer = rn
| otherwise = isTermVarOrFieldNameSpace
typeNsChoices
| isDataOcc occ = isTcClsNameSpace
+ | isSymOcc occ = isTcClsNameSpace
| otherwise = isTvNameSpace
-- Generate the choices for the possible kind of thing this
-- is. We narrow down the possibilities with the namespace (if
=====================================
utils/haddock/html-test/ref/PatternSyns.html
=====================================
@@ -308,8 +308,10 @@
></p
><div class="doc"
><p
- >Doc for (<code class="inline-code"
- >><</code
+ >Doc for (<code
+ ><a href="#" title="PatternSyns"
+ >><</a
+ ></code
>)</p
></div
><div class="subs constructors"
=====================================
utils/haddock/html-test/ref/TypeOperators.html
=====================================
@@ -48,6 +48,34 @@
><p class="caption"
>TypeOperators</p
></div
+ ><div id="description"
+ ><p class="caption"
+ >Description</p
+ ><div class="doc"
+ ><p
+ >This documentation refers to <code
+ ><a href="#" title="Data.Type.Equality"
+ >~</a
+ ></code
+ >, <code
+ ><a href="#" title="TypeOperators"
+ >:-:</a
+ ></code
+ >, <code
+ ><a href="#" title="TypeOperators"
+ >:+:</a
+ ></code
+ >, <code
+ ><a href="#" title="TypeOperators"
+ ><=></a
+ ></code
+ >, and <code
+ ><a href="#" title="TypeOperators"
+ >|||</a
+ ></code
+ >.</p
+ ></div
+ ></div
><div id="interface"
><h1
>Documentation</h1
@@ -142,6 +170,18 @@
></p
></div
><div class="top"
+ ><p class="src"
+ ><span class="keyword"
+ >type</span
+ > <a id="t:-124--124--124-" class="def"
+ >(|||)</a
+ > = <a href="#" title="Data.Either"
+ >Either</a
+ > <a href="#" class="selflink"
+ >#</a
+ ></p
+ ></div
+ ><div class="top"
><p class="src"
><a id="v:biO" class="def"
>biO</a
=====================================
utils/haddock/html-test/src/TypeOperators.hs
=====================================
@@ -1,5 +1,6 @@
{-# LANGUAGE Haskell2010 #-}
{-# LANGUAGE TypeOperators, GADTs, MultiParamTypeClasses, FlexibleContexts #-}
+-- | This documentation refers to '~', ':-:', ':+:', '<=>', and '|||'.
module TypeOperators where
data a :-: b
@@ -12,6 +13,8 @@ newtype (g `O` f) a = O { unO :: g (f a) }
class a <=> b
+type (|||) = Either
+
biO :: (g `O` f) a
biO = undefined
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a0adc30d892f14f543f39d5c45facca…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a0adc30d892f14f543f39d5c45facca…
You're receiving this email because of your account on gitlab.haskell.org.
1
0

[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 3 commits: Expose all of Backtraces' internals for ghc-internal
by Marge Bot (@marge-bot) 30 May '25
by Marge Bot (@marge-bot) 30 May '25
30 May '25
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
16014bf8 by Hécate Kleidukos at 2025-05-28T20:09:34-04:00
Expose all of Backtraces' internals for ghc-internal
Closes #26049
- - - - -
e4602479 by Ryan Hendrickson at 2025-05-30T09:52:18-04:00
haddock: Fix links to type operators
- - - - -
399f49c6 by Mario Blažević at 2025-05-30T09:52:29-04:00
Introduce parenBreakableList and use it in ppHsContext
- - - - -
14 changed files:
- libraries/ghc-internal/src/GHC/Internal/Exception/Backtrace.hs
- 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/haddock-api/src/Haddock/Interface/LexParseRn.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/PatternSyns.html
- utils/haddock/html-test/ref/TypeOperators.html
- utils/haddock/html-test/src/TypeOperators.hs
Changes:
=====================================
libraries/ghc-internal/src/GHC/Internal/Exception/Backtrace.hs
=====================================
@@ -3,16 +3,7 @@
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE RankNTypes #-}
-module GHC.Internal.Exception.Backtrace
- ( -- * Backtrace mechanisms
- BacktraceMechanism(..)
- , getBacktraceMechanismState
- , setBacktraceMechanismState
- -- * Collecting backtraces
- , Backtraces(..)
- , displayBacktraces
- , collectBacktraces
- ) where
+module GHC.Internal.Exception.Backtrace where
import GHC.Internal.Base
import GHC.Internal.Data.OldList
=====================================
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/haddock-api/src/Haddock/Interface/LexParseRn.hs
=====================================
@@ -155,6 +155,7 @@ rename sDocContext renamer = rn
| otherwise = isTermVarOrFieldNameSpace
typeNsChoices
| isDataOcc occ = isTcClsNameSpace
+ | isSymOcc occ = isTcClsNameSpace
| otherwise = isTvNameSpace
-- Generate the choices for the possible kind of thing this
-- is. We narrow down the possibilities with the namespace (if
=====================================
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"
></span
- > (<a href="#" title="Data.Foldable1"
- >Foldable1</a
- > f, <a href="#" title="Data.Foldable1"
- >Foldable1</a
- > g) => <a href="#" title="Data.Foldable1"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Foldable1"
+ >Foldable1</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Foldable1"
+ >Foldable1</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Data.Foldable1"
>Foldable1</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -459,11 +465,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Eq1:3"
></span
- > (<a href="#" title="Data.Functor.Classes"
- >Eq1</a
- > f, <a href="#" title="Data.Functor.Classes"
- >Eq1</a
- > g) => <a href="#" title="Data.Functor.Classes"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Functor.Classes"
+ >Eq1</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Functor.Classes"
+ >Eq1</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Data.Functor.Classes"
>Eq1</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -513,11 +525,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Ord1:4"
></span
- > (<a href="#" title="Data.Functor.Classes"
- >Ord1</a
- > f, <a href="#" title="Data.Functor.Classes"
- >Ord1</a
- > g) => <a href="#" title="Data.Functor.Classes"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Functor.Classes"
+ >Ord1</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Functor.Classes"
+ >Ord1</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Data.Functor.Classes"
>Ord1</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -567,11 +585,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Read1:5"
></span
- > (<a href="#" title="Data.Functor.Classes"
- >Read1</a
- > f, <a href="#" title="Data.Functor.Classes"
- >Read1</a
- > g) => <a href="#" title="Data.Functor.Classes"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Functor.Classes"
+ >Read1</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Functor.Classes"
+ >Read1</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Data.Functor.Classes"
>Read1</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -669,11 +693,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Show1:6"
></span
- > (<a href="#" title="Data.Functor.Classes"
- >Show1</a
- > f, <a href="#" title="Data.Functor.Classes"
- >Show1</a
- > g) => <a href="#" title="Data.Functor.Classes"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Functor.Classes"
+ >Show1</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Functor.Classes"
+ >Show1</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Data.Functor.Classes"
>Show1</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -743,11 +773,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Contravariant:7"
></span
- > (<a href="#" title="Data.Functor.Contravariant"
- >Contravariant</a
- > f, <a href="#" title="Data.Functor.Contravariant"
- >Contravariant</a
- > g) => <a href="#" title="Data.Functor.Contravariant"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Functor.Contravariant"
+ >Contravariant</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Functor.Contravariant"
+ >Contravariant</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Data.Functor.Contravariant"
>Contravariant</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -799,11 +835,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Alternative:8"
></span
- > (<a href="#" title="Control.Applicative"
- >Alternative</a
- > f, <a href="#" title="Control.Applicative"
- >Alternative</a
- > g) => <a href="#" title="Control.Applicative"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Control.Applicative"
+ >Alternative</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Control.Applicative"
+ >Alternative</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Control.Applicative"
>Alternative</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -879,11 +921,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Applicative:9"
></span
- > (<a href="#" title="Control.Applicative"
- >Applicative</a
- > f, <a href="#" title="Control.Applicative"
- >Applicative</a
- > g) => <a href="#" title="Control.Applicative"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Control.Applicative"
+ >Applicative</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Control.Applicative"
+ >Applicative</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Control.Applicative"
>Applicative</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -975,11 +1023,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Functor:10"
></span
- > (<a href="#" title="Control.Monad"
- >Functor</a
- > f, <a href="#" title="Control.Monad"
- >Functor</a
- > g) => <a href="#" title="Control.Monad"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Control.Monad"
+ >Functor</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Control.Monad"
+ >Functor</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Control.Monad"
>Functor</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -1035,11 +1089,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Monad:11"
></span
- > (<a href="#" title="Control.Monad"
- >Monad</a
- > f, <a href="#" title="Control.Monad"
- >Monad</a
- > g) => <a href="#" title="Control.Monad"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Control.Monad"
+ >Monad</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Control.Monad"
+ >Monad</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Control.Monad"
>Monad</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -1107,11 +1167,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:MonadPlus:12"
></span
- > (<a href="#" title="Control.Monad"
- >MonadPlus</a
- > f, <a href="#" title="Control.Monad"
- >MonadPlus</a
- > g) => <a href="#" title="Control.Monad"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Control.Monad"
+ >MonadPlus</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Control.Monad"
+ >MonadPlus</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Control.Monad"
>MonadPlus</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -1167,11 +1233,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:MonadFix:13"
></span
- > (<a href="#" title="Control.Monad.Fix"
- >MonadFix</a
- > f, <a href="#" title="Control.Monad.Fix"
- >MonadFix</a
- > g) => <a href="#" title="Control.Monad.Fix"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Control.Monad.Fix"
+ >MonadFix</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Control.Monad.Fix"
+ >MonadFix</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Control.Monad.Fix"
>MonadFix</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -1217,11 +1289,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:MonadZip:14"
></span
- > (<a href="#" title="Control.Monad.Zip"
- >MonadZip</a
- > f, <a href="#" title="Control.Monad.Zip"
- >MonadZip</a
- > g) => <a href="#" title="Control.Monad.Zip"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Control.Monad.Zip"
+ >MonadZip</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Control.Monad.Zip"
+ >MonadZip</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Control.Monad.Zip"
>MonadZip</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -1293,11 +1371,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Foldable:15"
></span
- > (<a href="#" title="Data.Foldable"
- >Foldable</a
- > f, <a href="#" title="Data.Foldable"
- >Foldable</a
- > g) => <a href="#" title="Data.Foldable"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Foldable"
+ >Foldable</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Foldable"
+ >Foldable</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Data.Foldable"
>Foldable</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -1491,11 +1575,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Traversable:16"
></span
- > (<a href="#" title="Data.Traversable"
- >Traversable</a
- > f, <a href="#" title="Data.Traversable"
- >Traversable</a
- > g) => <a href="#" title="Data.Traversable"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Traversable"
+ >Traversable</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Traversable"
+ >Traversable</a
+ > g</span
+ >)</span
+ > => <a href="#" title="Data.Traversable"
>Traversable</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -1579,11 +1669,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Monoid:17"
></span
- > (<a href="#" title="Data.Monoid"
- >Monoid</a
- > (f a), <a href="#" title="Data.Monoid"
- >Monoid</a
- > (g a)) => <a href="#" title="Data.Monoid"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Monoid"
+ >Monoid</a
+ > (f a)</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Monoid"
+ >Monoid</a
+ > (g a)</span
+ >)</span
+ > => <a href="#" title="Data.Monoid"
>Monoid</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -1649,11 +1745,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Semigroup:18"
></span
- > (<a href="#" title="Prelude"
- >Semigroup</a
- > (f a), <a href="#" title="Prelude"
- >Semigroup</a
- > (g a)) => <a href="#" title="Prelude"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Semigroup</a
+ > (f a)</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Semigroup</a
+ > (g a)</span
+ >)</span
+ > => <a href="#" title="Prelude"
>Semigroup</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -1725,11 +1827,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Eq:19"
></span
- > (<a href="#" title="Data.Eq"
- >Eq</a
- > (f a), <a href="#" title="Data.Eq"
- >Eq</a
- > (g a)) => <a href="#" title="Data.Eq"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Eq"
+ >Eq</a
+ > (f a)</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Eq"
+ >Eq</a
+ > (g a)</span
+ >)</span
+ > => <a href="#" title="Data.Eq"
>Eq</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -1789,11 +1897,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Ord:20"
></span
- > (<a href="#" title="Data.Ord"
- >Ord</a
- > (f a), <a href="#" title="Data.Ord"
- >Ord</a
- > (g a)) => <a href="#" title="Data.Ord"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Ord"
+ >Ord</a
+ > (f a)</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Ord"
+ >Ord</a
+ > (g a)</span
+ >)</span
+ > => <a href="#" title="Data.Ord"
>Ord</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -1913,19 +2027,33 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Data:21"
></span
- > (<a href="#" title="Data.Dynamic"
- >Typeable</a
- > a, <a href="#" title="Data.Dynamic"
- >Typeable</a
- > f, <a href="#" title="Data.Dynamic"
- >Typeable</a
- > g, <a href="#" title="Data.Dynamic"
- >Typeable</a
- > k, <a href="#" title="Data.Data"
- >Data</a
- > (f a), <a href="#" title="Data.Data"
- >Data</a
- > (g a)) => <a href="#" title="Data.Data"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Dynamic"
+ >Typeable</a
+ > a</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Dynamic"
+ >Typeable</a
+ > f</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Dynamic"
+ >Typeable</a
+ > g</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Dynamic"
+ >Typeable</a
+ > k</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Data"
+ >Data</a
+ > (f a)</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Data"
+ >Data</a
+ > (g a)</span
+ >)</span
+ > => <a href="#" title="Data.Data"
>Data</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -2027,11 +2155,17 @@
>Typeable</a
> t => (<span class="keyword"
>forall</span
- > d e. (<a href="#" title="Data.Data"
- >Data</a
- > d, <a href="#" title="Data.Data"
- >Data</a
- > e) => c (t d e)) -> <a href="#" title="Data.Maybe"
+ > d e. <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Data"
+ >Data</a
+ > d</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Data"
+ >Data</a
+ > e</span
+ >)</span
+ > => c (t d e)) -> <a href="#" title="Data.Maybe"
>Maybe</a
> (c (<a href="#" title="Bug1004"
>Product</a
@@ -2315,11 +2449,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Read:23"
></span
- > (<a href="#" title="Prelude"
- >Read</a
- > (f a), <a href="#" title="Prelude"
- >Read</a
- > (g a)) => <a href="#" title="Prelude"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Read</a
+ > (f a)</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Read</a
+ > (g a)</span
+ >)</span
+ > => <a href="#" title="Prelude"
>Read</a
> (<a href="#" title="Bug1004"
>Product</a
@@ -2397,11 +2537,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:Product:Show:24"
></span
- > (<a href="#" title="Prelude"
- >Show</a
- > (f a), <a href="#" title="Prelude"
- >Show</a
- > (g a)) => <a href="#" title="Prelude"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Show</a
+ > (f a)</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Show</a
+ > (g a)</span
+ >)</span
+ > => <a href="#" title="Prelude"
>Show</a
> (<a href="#" title="Bug1004"
>Product</a
=====================================
utils/haddock/html-test/ref/Bug548.html
=====================================
@@ -252,11 +252,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:WrappedArrow:Alternative:2"
></span
- > (<a href="#" title="Control.Arrow"
- >ArrowZero</a
- > a, <a href="#" title="Control.Arrow"
- >ArrowPlus</a
- > a) => <a href="#" title="Control.Applicative"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Control.Arrow"
+ >ArrowZero</a
+ > a</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Control.Arrow"
+ >ArrowPlus</a
+ > a</span
+ >)</span
+ > => <a href="#" title="Control.Applicative"
>Alternative</a
> (<a href="#" title="Bug548"
>WrappedArrow</a
@@ -484,15 +490,25 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:id:WrappedArrow:Data:5"
></span
- > (<a href="#" title="Data.Dynamic"
- >Typeable</a
- > a, <a href="#" title="Data.Dynamic"
- >Typeable</a
- > b, <a href="#" title="Data.Dynamic"
- >Typeable</a
- > c, <a href="#" title="Data.Data"
- >Data</a
- > (a b c)) => <a href="#" title="Data.Data"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Dynamic"
+ >Typeable</a
+ > a</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Dynamic"
+ >Typeable</a
+ > b</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Dynamic"
+ >Typeable</a
+ > c</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Data"
+ >Data</a
+ > (a b c)</span
+ >)</span
+ > => <a href="#" title="Data.Data"
>Data</a
> (<a href="#" title="Bug548"
>WrappedArrow</a
@@ -594,11 +610,17 @@
>Typeable</a
> t => (<span class="keyword"
>forall</span
- > d e. (<a href="#" title="Data.Data"
- >Data</a
- > d, <a href="#" title="Data.Data"
- >Data</a
- > e) => c0 (t d e)) -> <a href="#" title="Data.Maybe"
+ > d e. <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Data"
+ >Data</a
+ > d</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Data.Data"
+ >Data</a
+ > e</span
+ >)</span
+ > => c0 (t d e)) -> <a href="#" title="Data.Maybe"
>Maybe</a
> (c0 (<a href="#" title="Bug548"
>WrappedArrow</a
=====================================
utils/haddock/html-test/ref/Bug973.html
=====================================
@@ -56,21 +56,33 @@
><li class="src short"
><a href="#"
>showRead</a
- > :: (<a href="#" title="Prelude"
- >Show</a
- > a, <a href="#" title="Prelude"
- >Read</a
- > b) => a -> b</li
+ > :: <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Show</a
+ > a</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Read</a
+ > b</span
+ >)</span
+ > => a -> b</li
><li class="src short"
><a href="#"
>showRead'</a
> :: <span class="keyword"
>forall</span
- > b a. (<a href="#" title="Prelude"
- >Show</a
- > a, <a href="#" title="Prelude"
- >Read</a
- > b) => a -> b</li
+ > b a. <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Show</a
+ > a</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Read</a
+ > b</span
+ >)</span
+ > => a -> b</li
></ul
></details
></div
@@ -90,11 +102,17 @@
><table
><tr
><td class="src"
- >:: (<a href="#" title="Prelude"
- >Show</a
- > a, <a href="#" title="Prelude"
- >Read</a
- > b)</td
+ >:: <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Show</a
+ > a</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Read</a
+ > b</span
+ >)</span
+ ></td
><td class="doc empty"
> </td
></tr
@@ -132,11 +150,17 @@
><td class="src"
>:: <span class="keyword"
>forall</span
- > b a. (<a href="#" title="Prelude"
- >Show</a
- > a, <a href="#" title="Prelude"
- >Read</a
- > b)</td
+ > b a. <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Show</a
+ > a</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Prelude"
+ >Read</a
+ > b</span
+ >)</span
+ ></td
><td class="doc empty"
> </td
></tr
=====================================
utils/haddock/html-test/ref/Hash.html
=====================================
@@ -99,11 +99,17 @@
><li class="src short"
><a href="#"
>new</a
- > :: (<a href="#" title="Data.Eq"
- >Eq</a
- > key, <a href="#" title="Hash"
- >Hash</a
- > key) => <a href="#" title="Data.Int"
+ > :: <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Eq"
+ >Eq</a
+ > key</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Hash"
+ >Hash</a
+ > key</span
+ >)</span
+ > => <a href="#" title="Data.Int"
>Int</a
> -> <a href="#" title="Prelude"
>IO</a
@@ -113,11 +119,17 @@
><li class="src short"
><a href="#"
>insert</a
- > :: (<a href="#" title="Data.Eq"
- >Eq</a
- > key, <a href="#" title="Hash"
- >Hash</a
- > key) => key -> val -> <a href="#" title="Prelude"
+ > :: <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Eq"
+ >Eq</a
+ > key</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Hash"
+ >Hash</a
+ > key</span
+ >)</span
+ > => key -> val -> <a href="#" title="Prelude"
>IO</a
> ()</li
><li class="src short"
@@ -191,11 +203,17 @@
><p class="src"
><a id="v:new" class="def"
>new</a
- > :: (<a href="#" title="Data.Eq"
- >Eq</a
- > key, <a href="#" title="Hash"
- >Hash</a
- > key) => <a href="#" title="Data.Int"
+ > :: <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Eq"
+ >Eq</a
+ > key</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Hash"
+ >Hash</a
+ > key</span
+ >)</span
+ > => <a href="#" title="Data.Int"
>Int</a
> -> <a href="#" title="Prelude"
>IO</a
@@ -213,11 +231,17 @@
><p class="src"
><a id="v:insert" class="def"
>insert</a
- > :: (<a href="#" title="Data.Eq"
- >Eq</a
- > key, <a href="#" title="Hash"
- >Hash</a
- > key) => key -> val -> <a href="#" title="Prelude"
+ > :: <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Eq"
+ >Eq</a
+ > key</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Hash"
+ >Hash</a
+ > key</span
+ >)</span
+ > => key -> val -> <a href="#" title="Prelude"
>IO</a
> () <a href="#" class="selflink"
>#</a
@@ -395,11 +419,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:ic:Hash:Hash:3"
></span
- > (<a href="#" title="Hash"
- >Hash</a
- > a, <a href="#" title="Hash"
- >Hash</a
- > b) => <a href="#" title="Hash"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Hash"
+ >Hash</a
+ > a</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Hash"
+ >Hash</a
+ > b</span
+ >)</span
+ > => <a href="#" title="Hash"
>Hash</a
> (a, b)</span
> <a href="#" class="selflink"
=====================================
utils/haddock/html-test/ref/ImplicitParams.html
=====================================
@@ -91,11 +91,17 @@
><p class="src"
><a id="v:d" class="def"
>d</a
- > :: (?x :: <a href="#" title="ImplicitParams"
- >X</a
- >, ?y :: <a href="#" title="ImplicitParams"
- >X</a
- >) => (<a href="#" title="ImplicitParams"
+ > :: <span class="breakable"
+ >(<span class="unbreakable"
+ >?x :: <a href="#" title="ImplicitParams"
+ >X</a
+ ></span
+ >, <span class="unbreakable"
+ >?y :: <a href="#" title="ImplicitParams"
+ >X</a
+ ></span
+ >)</span
+ > => (<a href="#" title="ImplicitParams"
>X</a
>, <a href="#" title="ImplicitParams"
>X</a
=====================================
utils/haddock/html-test/ref/Instances.html
=====================================
@@ -438,11 +438,17 @@
><span class="inst-left"
><span class="instance details-toggle-control details-toggle" data-details-id="i:ic:Foo:Foo:5"
></span
- > (<a href="#" title="Data.Eq"
- >Eq</a
- > a, <a href="#" title="Instances"
- >Foo</a
- > f) => <a href="#" title="Instances"
+ > <span class="breakable"
+ >(<span class="unbreakable"
+ ><a href="#" title="Data.Eq"
+ >Eq</a
+ > a</span
+ >, <span class="unbreakable"
+ ><a href="#" title="Instances"
+ >Foo</a
+ > f</span
+ >)</span
+ > => <a href="#" title="Instances"
>Foo</a
> ((,) (f a))</span
> <a href="#" class="selflink"
=====================================
utils/haddock/html-test/ref/PatternSyns.html
=====================================
@@ -308,8 +308,10 @@
></p
><div class="doc"
><p
- >Doc for (<code class="inline-code"
- >><</code
+ >Doc for (<code
+ ><a href="#" title="PatternSyns"
+ >><</a
+ ></code
>)</p
></div
><div class="subs constructors"
=====================================
utils/haddock/html-test/ref/TypeOperators.html
=====================================
@@ -48,6 +48,34 @@
><p class="caption"
>TypeOperators</p
></div
+ ><div id="description"
+ ><p class="caption"
+ >Description</p
+ ><div class="doc"
+ ><p
+ >This documentation refers to <code
+ ><a href="#" title="Data.Type.Equality"
+ >~</a
+ ></code
+ >, <code
+ ><a href="#" title="TypeOperators"
+ >:-:</a
+ ></code
+ >, <code
+ ><a href="#" title="TypeOperators"
+ >:+:</a
+ ></code
+ >, <code
+ ><a href="#" title="TypeOperators"
+ ><=></a
+ ></code
+ >, and <code
+ ><a href="#" title="TypeOperators"
+ >|||</a
+ ></code
+ >.</p
+ ></div
+ ></div
><div id="interface"
><h1
>Documentation</h1
@@ -142,6 +170,18 @@
></p
></div
><div class="top"
+ ><p class="src"
+ ><span class="keyword"
+ >type</span
+ > <a id="t:-124--124--124-" class="def"
+ >(|||)</a
+ > = <a href="#" title="Data.Either"
+ >Either</a
+ > <a href="#" class="selflink"
+ >#</a
+ ></p
+ ></div
+ ><div class="top"
><p class="src"
><a id="v:biO" class="def"
>biO</a
@@ -175,11 +215,17 @@
><p class="src"
><a id="v:g" class="def"
>g</a
- > :: (a <a href="#" title="Data.Type.Equality"
- >~</a
- > b, b <a href="#" title="Data.Type.Equality"
- >~</a
- > c) => a -> c <a href="#" class="selflink"
+ > :: <span class="breakable"
+ >(<span class="unbreakable"
+ >a <a href="#" title="Data.Type.Equality"
+ >~</a
+ > b</span
+ >, <span class="unbreakable"
+ >b <a href="#" title="Data.Type.Equality"
+ >~</a
+ > c</span
+ >)</span
+ > => a -> c <a href="#" class="selflink"
>#</a
></p
></div
@@ -201,13 +247,19 @@
><p class="src"
><a id="v:y" class="def"
>y</a
- > :: (a <a href="#" title="TypeOperators"
- ><=></a
- > a, <a href="#" title="TypeOperators"
- >Op</a
- > a a <a href="#" title="TypeOperators"
- ><=></a
- > a) => a <a href="#" class="selflink"
+ > :: <span class="breakable"
+ >(<span class="unbreakable"
+ >a <a href="#" title="TypeOperators"
+ ><=></a
+ > a</span
+ >, <span class="unbreakable"
+ ><a href="#" title="TypeOperators"
+ >Op</a
+ > a a <a href="#" title="TypeOperators"
+ ><=></a
+ > a</span
+ >)</span
+ > => a <a href="#" class="selflink"
>#</a
></p
></div
=====================================
utils/haddock/html-test/src/TypeOperators.hs
=====================================
@@ -1,5 +1,6 @@
{-# LANGUAGE Haskell2010 #-}
{-# LANGUAGE TypeOperators, GADTs, MultiParamTypeClasses, FlexibleContexts #-}
+-- | This documentation refers to '~', ':-:', ':+:', '<=>', and '|||'.
module TypeOperators where
data a :-: b
@@ -12,6 +13,8 @@ newtype (g `O` f) a = O { unO :: g (f a) }
class a <=> b
+type (|||) = Either
+
biO :: (g `O` f) a
biO = undefined
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/fef1a930cea05dc9b0bfa527ec66e1…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/fef1a930cea05dc9b0bfa527ec66e1…
You're receiving this email because of your account on gitlab.haskell.org.
1
0

[Git][ghc/ghc][wip/fendor/ghci-multiple-home-units] 2 commits: Make GHCi commands compatible with multiple home units
by Hannes Siebenhandl (@fendor) 30 May '25
by Hannes Siebenhandl (@fendor) 30 May '25
30 May '25
Hannes Siebenhandl pushed to branch wip/fendor/ghci-multiple-home-units at Glasgow Haskell Compiler / GHC
Commits:
94515986 by fendor at 2025-05-30T14:46:56+02:00
Make GHCi commands compatible with multiple home units
=== Design
We enable all GHCi features that were previously guarded by the `inMulti`
option.
GHCi supported multiple home units up to a certain degree for quite a while now.
The supported feature set was limited, due to a design impasse:
One of the home units must be "active", e.g., there must be one `HomeUnit`
whose `UnitId` is "active" which is returned when calling
```haskell
do
hscActiveUnitId <$> getSession
```
This makes sense in a GHC session, since you are always compiling a particular
Module, but it makes less intuitive sense in an interactive session.
Given an expression to evaluate, we can't easily tell in which "context" the expression
should be parsed, typechecked and evaluated.
That's why initially, most of GHCi features, except for `:reload`ing were disabled
if the GHCi session had more than one `HomeUnitEnv`.
We lift this restriction, enabling all features of GHCi for the multiple home unit case.
To do this, we fundamentally change the `HomeUnitEnv` graph to be multiple home unit first.
Instead of differentiating the case were we have a single home unit and multiple,
we now always set up a multiple home unit session that scales seamlessly to an arbitrary
amount of home units.
We introduce two new `HomeUnitEnv`s that are always added to the `HomeUnitGraph`.
They are:
The "interactive-ghci", called the `interactiveGhciUnit`, contains the same
`DynFlags` that are used by the `InteractiveContext` for interactive evaluation
of expressions.
This `HomeUnitEnv` is only used on the prompt of GHCi, so we may refer to it as
"interactive-prompt" unit.
See Note [Relation between the `InteractiveContext` and `interactiveGhciUnitId`]
for discussing its role.
And the "interactive-session"", called `interactiveSessionUnit` or
`interactiveSessionUnitId`, which is used for loading Scripts into
GHCi that are not `Target`s of any home unit, via `:load` or `:add`.
Both of these "interactive" home units depend on all other `HomeUnitEnv`s that
are passed as arguments on the cli.
Additionally, the "interactive-ghci" unit depends on `interactive-session`.
We always evaluate expressions in the context of the
"interactive-ghci" session.
Since "interactive-ghci" depends on all home units, we can import any `Module`
from the other home units with ease.
As we have a clear `HomeUnitGraph` hierarchy, we can set `interactiveGhciUnitId`
as the active home unit for the full duration of the GHCi session.
In GHCi, we always set `interactiveGhciUnitId` to be the currently active home unit.
=== Implementation Details
Given this design idea, the implementation is relatively straight
forward.
The core insight is that a `ModuleName` is not sufficient to identify a
`Module` in the `HomeUnitGraph`. Thus, large parts of the PR is simply
about refactoring usages of `ModuleName` to prefer `Module`, which has a
`Unit` attached and is unique over the `HomeUnitGraph`.
Consequentially, most usages of `lookupHPT` are likely to be incorrect and have
been replaced by `lookupHugByModule` which is keyed by a `Module`.
In `GHCi/UI.hs`, we make sure there is only one location where we are
actually translating `ModuleName` to a `Module`:
* `lookupQualifiedModuleName`
If a `ModuleName` is ambiguous, we detect this and report it to the
user.
To avoid repeated lookups of `ModuleName`s, we store the `Module` in the
`InteractiveImport`, which additionally simplifies the interface
loading.
A subtle detail is that the `DynFlags` of the `InteractiveContext` are
now stored both in the `HomeUnitGraph` and in the `InteractiveContext`.
In UI.hs, there are multiple code paths where we are careful to update
the `DynFlags` in both locations.
Most importantly in `addToProgramDynFlags`.
---
There is one metric increase in this commit:
-------------------------
Metric Increase:
T4029
-------------------------
It is an increase from 14.4 MB to 16.1 MB (+11.8%) which sounds like a
pretty big regression at first.
However, we argue this increase is solely caused by using more data
structures for managing multiple home units in the GHCi session.
In particular, due to the design decision of using three home units, the
base memory usage increases... but by how much?
A big contributor is the `UnitState`, of which we have three now, which
on its own 260 KB per instance. That makes an additional memory usage of
520 KB, already explaining a third of the overall memory usage increase.
Then we store more elements in the `HomeUnitGraph`, we have more
`HomeUnitEnv` entries, etc...
While we didn't chase down each byte, we looked at the memory usage over time
for both `-hi` and `-hT` profiles and can say with confidence while the memory
usage increased slightly, we did not introduce any space leak, as
the graph looks almost identical as the memory usage graph of GHC HEAD.
---
Adds testcases for GHCi multiple home units session
* Test truly multiple home unit sessions, testing reload logic and code evaluation.
* Test that GHCi commands such as `:all-types`, `:browse`, etc., work
* Object code reloading for home modules
* GHCi debugger multiple home units session
- - - - -
67ea95e6 by fendor at 2025-05-30T14:46:56+02:00
Update "loading compiled code" GHCi documentation
To use object code in GHCi, the module needs to be compiled for use in
GHCi. To do that, users need to compile their modules with:
* `-dynamic`
* `-this-unit-id interactive-session`
Otherwise, the interface files will not match.
- - - - -
131 changed files:
- compiler/GHC.hs
- compiler/GHC/Driver/Downsweep.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Iface/Load.hs
- compiler/GHC/Rename/Unbound.hs
- compiler/GHC/Runtime/Context.hs
- compiler/GHC/Runtime/Eval.hs
- compiler/GHC/StgToByteCode.hs
- compiler/GHC/StgToJS/Linker/Linker.hs
- compiler/GHC/Tc/Module.hs
- compiler/GHC/Types/Name/Ppr.hs
- compiler/GHC/Unit/Env.hs
- compiler/GHC/Unit/Home/Graph.hs
- compiler/GHC/Unit/Types.hs
- docs/users_guide/ghci.rst
- ghc/GHCi/UI.hs
- ghc/GHCi/UI/Exception.hs
- ghc/GHCi/UI/Info.hs
- ghc/GHCi/UI/Monad.hs
- ghc/Main.hs
- testsuite/driver/testlib.py
- testsuite/tests/driver/T8526/T8526.stdout
- testsuite/tests/driver/fat-iface/fat014.stdout
- testsuite/tests/driver/multipleHomeUnits/multiGHCi.stderr
- testsuite/tests/ghc-api/T6145.hs
- testsuite/tests/ghc-api/annotations-literals/literals.hs
- testsuite/tests/ghc-api/annotations-literals/parsed.hs
- testsuite/tests/ghc-api/apirecomp001/myghc.hs
- testsuite/tests/ghc-api/fixed-nodes/T1.hs
- + testsuite/tests/ghci.debugger/scripts/break031/Makefile
- + testsuite/tests/ghci.debugger/scripts/break031/a/A.hs
- + testsuite/tests/ghci.debugger/scripts/break031/all.T
- + testsuite/tests/ghci.debugger/scripts/break031/b/B.hs
- + testsuite/tests/ghci.debugger/scripts/break031/break031a.script
- + testsuite/tests/ghci.debugger/scripts/break031/break031a.stdout
- + testsuite/tests/ghci.debugger/scripts/break031/break031b.script
- + testsuite/tests/ghci.debugger/scripts/break031/break031b.stderr
- + testsuite/tests/ghci.debugger/scripts/break031/break031b.stdout
- + testsuite/tests/ghci.debugger/scripts/break031/unitA
- + testsuite/tests/ghci.debugger/scripts/break031/unitB
- testsuite/tests/ghci/linking/dyn/T3372.hs
- + testsuite/tests/ghci/prog-mhu001/Makefile
- + testsuite/tests/ghci/prog-mhu001/all.T
- + testsuite/tests/ghci/prog-mhu001/e/E.hs
- + testsuite/tests/ghci/prog-mhu001/prog-mhu001a.script
- + testsuite/tests/ghci/prog-mhu001/prog-mhu001a.stdout
- + testsuite/tests/ghci/prog-mhu001/prog-mhu001b.script
- + testsuite/tests/ghci/prog-mhu001/prog-mhu001b.stdout
- + testsuite/tests/ghci/prog-mhu001/prog-mhu001c.script
- + testsuite/tests/ghci/prog-mhu001/prog-mhu001c.stdout
- + testsuite/tests/ghci/prog-mhu001/prog-mhu001d.script
- + testsuite/tests/ghci/prog-mhu001/prog-mhu001d.stdout
- + testsuite/tests/ghci/prog-mhu001/prog-mhu001e.script
- + testsuite/tests/ghci/prog-mhu001/prog-mhu001e.stdout
- + testsuite/tests/ghci/prog-mhu001/prog-mhu001f.script
- + testsuite/tests/ghci/prog-mhu001/prog-mhu001f.stdout
- + testsuite/tests/ghci/prog-mhu001/unitE
- + testsuite/tests/ghci/prog-mhu001/unitE-main-is
- + testsuite/tests/ghci/prog-mhu002/Makefile
- + testsuite/tests/ghci/prog-mhu002/a/A.hs
- + testsuite/tests/ghci/prog-mhu002/all.T
- + testsuite/tests/ghci/prog-mhu002/b/B.hs
- + testsuite/tests/ghci/prog-mhu002/c/C.hs
- + testsuite/tests/ghci/prog-mhu002/d/Main.hs
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002a.script
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002a.stderr
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002a.stdout
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002b.script
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002b.stderr
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002b.stdout
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002c.script
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002c.stdout
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002d.script
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002d.stdout
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002e.script
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002e.stdout
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002f.script
- + testsuite/tests/ghci/prog-mhu002/prog-mhu002f.stdout
- + testsuite/tests/ghci/prog-mhu002/unitA
- + testsuite/tests/ghci/prog-mhu002/unitB
- + testsuite/tests/ghci/prog-mhu002/unitC
- + testsuite/tests/ghci/prog-mhu002/unitD
- + testsuite/tests/ghci/prog-mhu003/Makefile
- + testsuite/tests/ghci/prog-mhu003/a/A.hs
- + testsuite/tests/ghci/prog-mhu003/all.T
- + testsuite/tests/ghci/prog-mhu003/b/Foo.hs
- + testsuite/tests/ghci/prog-mhu003/c/C.hs
- + testsuite/tests/ghci/prog-mhu003/d/Foo.hs
- + testsuite/tests/ghci/prog-mhu003/prog-mhu003.script
- + testsuite/tests/ghci/prog-mhu003/prog-mhu003.stderr
- + testsuite/tests/ghci/prog-mhu003/prog-mhu003.stdout
- + testsuite/tests/ghci/prog-mhu003/unitA
- + testsuite/tests/ghci/prog-mhu003/unitB
- + testsuite/tests/ghci/prog-mhu003/unitC
- + testsuite/tests/ghci/prog-mhu003/unitD
- + testsuite/tests/ghci/prog-mhu004/Makefile
- + testsuite/tests/ghci/prog-mhu004/a/Foo.hs
- + testsuite/tests/ghci/prog-mhu004/all.T
- + testsuite/tests/ghci/prog-mhu004/b/Foo.hs
- + testsuite/tests/ghci/prog-mhu004/prog-mhu004a.script
- + testsuite/tests/ghci/prog-mhu004/prog-mhu004a.stderr
- + testsuite/tests/ghci/prog-mhu004/prog-mhu004a.stdout
- + testsuite/tests/ghci/prog-mhu004/prog-mhu004b.script
- + testsuite/tests/ghci/prog-mhu004/prog-mhu004b.stdout
- + testsuite/tests/ghci/prog-mhu004/unitA
- + testsuite/tests/ghci/prog-mhu004/unitB
- testsuite/tests/ghci/prog010/ghci.prog010.script
- testsuite/tests/ghci/prog018/prog018.stdout
- + testsuite/tests/ghci/prog020/A.hs
- + testsuite/tests/ghci/prog020/B.hs
- + testsuite/tests/ghci/prog020/Makefile
- + testsuite/tests/ghci/prog020/all.T
- + testsuite/tests/ghci/prog020/ghci.prog020.script
- + testsuite/tests/ghci/prog020/ghci.prog020.stderr
- + testsuite/tests/ghci/prog020/ghci.prog020.stdout
- testsuite/tests/ghci/scripts/T13869.stdout
- testsuite/tests/ghci/scripts/T13997.stdout
- testsuite/tests/ghci/scripts/T17669.stdout
- testsuite/tests/ghci/scripts/T18330.stdout
- testsuite/tests/ghci/scripts/T1914.stdout
- testsuite/tests/ghci/scripts/T20217.stdout
- testsuite/tests/ghci/scripts/T20587.stdout
- testsuite/tests/ghci/scripts/T21110.stderr
- testsuite/tests/ghci/scripts/T6105.stdout
- testsuite/tests/ghci/scripts/T8042.stdout
- testsuite/tests/ghci/scripts/T8042recomp.stdout
- testsuite/tests/ghci/scripts/ghci024.stdout
- testsuite/tests/ghci/scripts/ghci024.stdout-mingw32
- testsuite/tests/ghci/scripts/ghci058.script
- testsuite/tests/ghci/should_run/TopEnvIface.stdout
- testsuite/tests/quasiquotation/T7918.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/646aa87464601c385fc1c7c1ac45f3…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/646aa87464601c385fc1c7c1ac45f3…
You're receiving this email because of your account on gitlab.haskell.org.
1
0

[Git][ghc/ghc][master] Expose all of Backtraces' internals for ghc-internal
by Marge Bot (@marge-bot) 29 May '25
by Marge Bot (@marge-bot) 29 May '25
29 May '25
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
16014bf8 by Hécate Kleidukos at 2025-05-28T20:09:34-04:00
Expose all of Backtraces' internals for ghc-internal
Closes #26049
- - - - -
1 changed file:
- libraries/ghc-internal/src/GHC/Internal/Exception/Backtrace.hs
Changes:
=====================================
libraries/ghc-internal/src/GHC/Internal/Exception/Backtrace.hs
=====================================
@@ -3,16 +3,7 @@
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE RankNTypes #-}
-module GHC.Internal.Exception.Backtrace
- ( -- * Backtrace mechanisms
- BacktraceMechanism(..)
- , getBacktraceMechanismState
- , setBacktraceMechanismState
- -- * Collecting backtraces
- , Backtraces(..)
- , displayBacktraces
- , collectBacktraces
- ) where
+module GHC.Internal.Exception.Backtrace where
import GHC.Internal.Base
import GHC.Internal.Data.OldList
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/16014bf84afa0d009b6254b103033bc…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/16014bf84afa0d009b6254b103033bc…
You're receiving this email because of your account on gitlab.haskell.org.
1
0

[Git][ghc/ghc][master] Refactor handling of imported COMPLETE pragmas
by Marge Bot (@marge-bot) 29 May '25
by Marge Bot (@marge-bot) 29 May '25
29 May '25
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
b08c08ae by soulomoon at 2025-05-28T01:57:23+08:00
Refactor handling of imported COMPLETE pragmas
from the HPT
Previously, we imported COMPLETE pragmas from all modules in the Home
Package Table (HPT) during type checking. However, since !13675, there
may be non-below modules in the HPT from the dependency tree that we do
not want to import COMPLETE pragmas from. This refactor changes the way
we handle COMPLETE pragmas from the HPT to only import them from modules
that are "below" the current module in the HPT.
- Add hugCompleteSigsBelow to filter COMPLETE pragmas from "below"
modules in the HPT, mirroring hugRulesBelow.
- Move responsibility for calling hugCompleteSigsBelow to tcRnImports,
storing the result in the new tcg_complete_match_env field of TcGblEnv.
- Update getCompleteMatchesTcM to use tcg_complete_match_env.
This refactor only affects how COMPLETE pragmas are imported from the
HPT, imports from external packages are unchanged.
- - - - -
7 changed files:
- compiler/GHC/Driver/Env.hs
- compiler/GHC/HsToCore/Monad.hs
- compiler/GHC/Rename/Bind.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/Tc/Module.hs
- compiler/GHC/Tc/Types.hs
- compiler/GHC/Tc/Utils/Monad.hs
Changes:
=====================================
compiler/GHC/Driver/Env.hs
=====================================
@@ -33,6 +33,7 @@ module GHC.Driver.Env
, hugRulesBelow
, hugInstancesBelow
, hugAnnsBelow
+ , hugCompleteSigsBelow
-- * Legacy API
, hscUpdateHPT
@@ -79,6 +80,7 @@ import GHC.Utils.Logger
import GHC.Core.Rules
import GHC.Types.Annotations
+import GHC.Types.CompleteMatch
import GHC.Core.InstEnv
import GHC.Core.FamInstEnv
import GHC.Builtin.Names
@@ -228,6 +230,12 @@ hugAnnsBelow :: HscEnv -> UnitId -> ModuleNameWithIsBoot -> IO AnnEnv
hugAnnsBelow hsc uid mn = foldr (flip extendAnnEnvList) emptyAnnEnv <$>
hugSomeThingsBelowUs (md_anns . hm_details) False hsc uid mn
+-- | Find all COMPLETE pragmas in modules that are in the transitive closure of the
+-- given module.
+hugCompleteSigsBelow :: HscEnv -> UnitId -> ModuleNameWithIsBoot -> IO CompleteMatches
+hugCompleteSigsBelow hsc uid mn = foldr (++) [] <$>
+ hugSomeThingsBelowUs (md_complete_matches . hm_details) False hsc uid mn
+
-- | Find instances visible from the given set of imports
hugInstancesBelow :: HscEnv -> UnitId -> ModuleNameWithIsBoot -> IO (InstEnv, [FamInst])
hugInstancesBelow hsc_env uid mnwib = do
=====================================
compiler/GHC/HsToCore/Monad.hs
=====================================
@@ -266,9 +266,12 @@ mkDsEnvsFromTcGbl hsc_env msg_var tcg_env
ptc = initPromotionTickContext (hsc_dflags hsc_env)
-- re-use existing next_wrapper_num to ensure uniqueness
next_wrapper_num_var = tcg_next_wrapper_num tcg_env
+ tcg_comp_env = tcg_complete_match_env tcg_env
; ds_complete_matches <-
liftIO $ unsafeInterleaveIO $
+ -- Note [Lazily loading COMPLETE pragmas]
+ -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- This call to 'unsafeInterleaveIO' ensures we only do this work
-- when we need to look at the COMPLETE pragmas, avoiding doing work
-- when we don't need them.
@@ -276,7 +279,7 @@ mkDsEnvsFromTcGbl hsc_env msg_var tcg_env
-- Relevant test case: MultiLayerModulesTH_Make, which regresses
-- in allocations by ~5% if we don't do this.
traverse (lookupCompleteMatch type_env hsc_env) =<<
- localAndImportedCompleteMatches (tcg_complete_matches tcg_env) (hsc_unit_env hsc_env) eps
+ localAndImportedCompleteMatches tcg_comp_env eps
; return $ mkDsEnvs unit_env this_mod rdr_env type_env fam_inst_env ptc
msg_var cc_st_var next_wrapper_num_var ds_complete_matches
}
@@ -334,7 +337,7 @@ initDsWithModGuts hsc_env (ModGuts { mg_module = this_mod, mg_binds = binds
bindsToIds (Rec binds) = map fst binds
ids = concatMap bindsToIds binds
; ds_complete_matches <- traverse (lookupCompleteMatch type_env hsc_env) =<<
- localAndImportedCompleteMatches local_complete_matches (hsc_unit_env hsc_env) eps
+ localAndImportedCompleteMatches local_complete_matches eps
; let
envs = mkDsEnvs unit_env this_mod rdr_env type_env
fam_inst_env ptc msg_var cc_st_var
=====================================
compiler/GHC/Rename/Bind.hs
=====================================
@@ -338,7 +338,8 @@ rnValBindsRHS ctxt (ValBinds _ mbinds sigs)
-- Update the TcGblEnv with renamed COMPLETE pragmas from the current
-- module, for pattern irrefutability checking in do notation.
; let localCompletePrags = localCompletePragmas sigs'
- ; updGblEnv (\gblEnv -> gblEnv { tcg_complete_matches = tcg_complete_matches gblEnv ++ localCompletePrags}) $
+ ; updGblEnv (\gblEnv -> gblEnv { tcg_complete_matches = tcg_complete_matches gblEnv ++ localCompletePrags
+ , tcg_complete_match_env = tcg_complete_match_env gblEnv ++ localCompletePrags }) $
do { binds_w_dus <- mapM (rnLBind (mkScopedTvFn sigs')) mbinds
; let !(anal_binds, anal_dus) = depAnalBinds binds_w_dus
@@ -956,7 +957,8 @@ rnMethodBinds is_cls_decl cls ktv_names binds sigs
-- Update the TcGblEnv with renamed COMPLETE pragmas from the current
-- module, for pattern irrefutability checking in do notation.
- ; updGblEnv (\gblEnv -> gblEnv { tcg_complete_matches = tcg_complete_matches gblEnv ++ localCompletePrags}) $
+ ; updGblEnv (\gblEnv -> gblEnv { tcg_complete_matches = tcg_complete_matches gblEnv ++ localCompletePrags
+ , tcg_complete_match_env = tcg_complete_match_env gblEnv ++ localCompletePrags}) $
do {
-- Rename the bindings RHSs. Again there's an issue about whether the
-- type variables from the class/instance head are in scope.
=====================================
compiler/GHC/Rename/Module.hs
=====================================
@@ -222,7 +222,8 @@ rnSrcDecls group@(HsGroup { hs_valds = val_decls,
last_tcg_env0 <- getGblEnv ;
let { last_tcg_env =
last_tcg_env0
- { tcg_complete_matches = tcg_complete_matches last_tcg_env0 ++ localCompletePragmas sigs' }
+ { tcg_complete_matches = tcg_complete_matches last_tcg_env0 ++ localCompletePragmas sigs'
+ , tcg_complete_match_env = tcg_complete_match_env last_tcg_env0 ++ localCompletePragmas sigs'}
} ;
-- (I) Compute the results and return
let {rn_group = HsGroup { hs_ext = noExtField,
=====================================
compiler/GHC/Tc/Module.hs
=====================================
@@ -51,6 +51,7 @@ import GHC.Driver.Env
import GHC.Driver.Plugins
import GHC.Driver.DynFlags
import GHC.Driver.Config.Diagnostic
+import GHC.IO.Unsafe ( unsafeInterleaveIO )
import GHC.Tc.Errors.Hole.Plugin ( HoleFitPluginR (..) )
import GHC.Tc.Errors.Types
@@ -483,6 +484,12 @@ tcRnImports hsc_env import_decls
; (home_insts, home_fam_insts) <- liftIO $
hugInstancesBelow hsc_env unitId mnwib
+ -- We use 'unsafeInterleaveIO' to avoid redundant memory allocations
+ -- See Note [Lazily loading COMPLETE pragmas] from GHC.HsToCore.Monad
+ -- and see https://gitlab.haskell.org/ghc/ghc/-/merge_requests/14274#note_620545
+ ; completeSigsBelow <- liftIO $ unsafeInterleaveIO $
+ hugCompleteSigsBelow hsc_env unitId mnwib
+
-- Record boot-file info in the EPS, so that it's
-- visible to loadHiBootInterface in tcRnSrcDecls,
-- and any other incrementally-performed imports
@@ -495,6 +502,8 @@ tcRnImports hsc_env import_decls
gbl {
tcg_rdr_env = tcg_rdr_env gbl `plusGlobalRdrEnv` rdr_env,
tcg_imports = tcg_imports gbl `plusImportAvails` imports,
+ tcg_complete_match_env = tcg_complete_match_env gbl ++
+ completeSigsBelow,
tcg_import_decls = imp_user_spec,
tcg_rn_imports = rn_imports,
tcg_default = foldMap subsume tc_defaults,
=====================================
compiler/GHC/Tc/Types.hs
=====================================
@@ -507,6 +507,9 @@ data TcGblEnv
tcg_fam_inst_env :: !FamInstEnv, -- ^ Ditto for family instances
-- NB. BangPattern is to fix a leak, see #15111
tcg_ann_env :: AnnEnv, -- ^ And for annotations
+ tcg_complete_match_env :: CompleteMatches,
+ -- ^ The complete matches for all /home-package/ modules;
+ -- Includes the complete matches in tcg_complete_matches
-- Now a bunch of things about this module that are simply
-- accumulated, but never consulted until the end.
@@ -689,9 +692,10 @@ data TcGblEnv
-- ^ Wanted constraints of static forms.
-- See Note [Constraints in static forms].
tcg_complete_matches :: !CompleteMatches,
+ -- ^ Complete matches defined in this module.
- -- ^ Tracking indices for cost centre annotations
tcg_cc_st :: TcRef CostCentreState,
+ -- ^ Tracking indices for cost centre annotations
tcg_next_wrapper_num :: TcRef (ModuleEnv Int)
-- ^ See Note [Generating fresh names for FFI wrappers]
=====================================
compiler/GHC/Tc/Utils/Monad.hs
=====================================
@@ -328,6 +328,7 @@ initTc hsc_env hsc_src keep_rn_syntax mod loc do_this
tcg_inst_env = emptyInstEnv,
tcg_fam_inst_env = emptyFamInstEnv,
tcg_ann_env = emptyAnnEnv,
+ tcg_complete_match_env = [],
tcg_th_used = th_var,
tcg_th_needed_deps = th_needed_deps_var,
tcg_exports = [],
@@ -2425,15 +2426,14 @@ liftZonkM (ZonkM f) =
getCompleteMatchesTcM :: TcM CompleteMatches
getCompleteMatchesTcM
= do { hsc_env <- getTopEnv
- ; tcg_env <- getGblEnv
; eps <- liftIO $ hscEPS hsc_env
- ; liftIO $ localAndImportedCompleteMatches (tcg_complete_matches tcg_env) (hsc_unit_env hsc_env) eps
+ ; tcg_env <- getGblEnv
+ ; let tcg_comps = tcg_complete_match_env tcg_env
+ ; liftIO $ localAndImportedCompleteMatches tcg_comps eps
}
-localAndImportedCompleteMatches :: CompleteMatches -> UnitEnv -> ExternalPackageState -> IO CompleteMatches
-localAndImportedCompleteMatches tcg_comps unit_env eps = do
- hugCSigs <- hugCompleteSigs unit_env
+localAndImportedCompleteMatches :: CompleteMatches -> ExternalPackageState -> IO CompleteMatches
+localAndImportedCompleteMatches tcg_comps eps = do
return $
- tcg_comps -- from the current module
- ++ hugCSigs -- from the home package
- ++ eps_complete_matches eps -- from imports
+ tcg_comps -- from the current modulea and from the home package
+ ++ eps_complete_matches eps -- from external packages
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b08c08ae6a5b9252c5d350646e2b361…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b08c08ae6a5b9252c5d350646e2b361…
You're receiving this email because of your account on gitlab.haskell.org.
1
0

28 May '25
Simon Peyton Jones pushed to branch wip/T23109a at Glasgow Haskell Compiler / GHC
Commits:
406d6f0c by Simon Peyton Jones at 2025-05-28T22:57:44+01:00
Work on reallyRebuildCase
...split the continuation instead of making it dupable
- - - - -
2 changed files:
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
Changes:
=====================================
compiler/GHC/Core/Opt/Simplify/Iteration.hs
=====================================
@@ -2112,8 +2112,8 @@ wrapJoinCont env cont thing_inside
| otherwise
-- Normal case; see Note [Join points and case-of-case]
- = do { (floats1, cont') <- mkDupableCont env cont
- ; (floats2, result) <- thing_inside (env `setInScopeFromF` floats1) cont'
+ = do { (floats1, env', cont') <- mkDupableCont env cont
+ ; (floats2, result) <- thing_inside env' cont'
; return (floats1 `addFloats` floats2, result) }
@@ -3257,34 +3257,75 @@ doCaseToLet scrut case_bndr
--------------------------------------------------
reallyRebuildCase env scrut case_bndr alts cont
- | not (seCaseCase env) -- Only when case-of-case is on.
- -- See GHC.Driver.Config.Core.Opt.Simplify
- -- Note [Case-of-case and full laziness]
- = do { case_expr <- simplAlts env scrut case_bndr alts
- (mkBoringStop (contHoleType cont))
- ; rebuild (zapSubstEnv env) case_expr cont }
+ -- ToDo: this code has a lot in common with wrapJoinCont; combine
+ -- Also (join j = e in body) is very like a case with two alternatives
+ -- If we aren't going to push StrictArg f into a case, we shouldn't push
+ -- it into joins either. More reasons to common-up
+ | contIsStop cont -- Shortcut for commmon case
+ = do { case_expr <- simplAlts env scrut case_bndr alts cont
+ ; return (emptyFloats env, case_expr) }
| otherwise
- = do { (floats, env', cont') <- mkDupableCaseCont env alts cont
- ; case_expr <- simplAlts env' scrut
- (scaleIdBy holeScaling case_bndr)
- (scaleAltsBy holeScaling alts)
- cont'
- ; return (floats, case_expr) }
+ = do { let (cont_inner, cont_outer)
+-- | contIsDupable cont = all_inner cont -- Do this first, befoe seCaseCase
+-- -- (ToDo: explain... join points)
+ | not (seCaseCase env) = all_outer cont
+ | not alts_would_dup = all_inner cont
+ | otherwise = split cont -- See Note [Strict arguments]
+ -- seCaseCase: see GHC.Driver.Config.Core.Opt.Simplify
+ -- Note [Case-of-case and full laziness]
+
+ ; (floats1, env', cont_inner') <- mkDupableCaseCont env alts_would_dup cont_inner
+ ; case_expr <- simplAlts env' scrut case_bndr alts cont_inner'
+ ; let (floats1', case_expr') = wrapJoinFloatsX floats1 case_expr
+ ; (floats2, res_expr) <- rebuild env' case_expr' cont_outer
+ ; return (floats1' `addFloats` floats2, res_expr) }
where
- holeScaling = contHoleScaling cont
- -- Note [Scaling in case-of-case]
+ alts_would_dup = altsWouldDup alts
+
+ all_outer cont = (mkBoringStop (contHoleType cont), cont)
+ all_inner cont = (cont, mkBoringStop (contResultType cont))
+
+ -- Tricky function! We must push OkToDup things into cont_inner,
+ -- to maintain join points
+ dont_push_inside_multi_case :: SimplCont -> Bool
+ dont_push_inside_multi_case cont
+ = case cont of
+ StrictArg { sc_fun = fun, sc_dup = dup }
+ -> not (okToDup dup) && null (ai_rules fun)
+ StrictBind { sc_dup = dup }
+ -> not (okToDup dup)
+ _ -> False
+
+ split cont@(Stop {}) = (cont, cont)
+ split cont
+ | dont_push_inside_multi_case cont = all_outer cont
+ | otherwise = (cont { sc_cont = inner }, outer)
+ where
+ (inner, outer) = split (sc_cont cont)
-{-
-simplCaseBinder checks whether the scrutinee is a variable, v. If so,
-try to eliminate uses of v in the RHSs in favour of case_bndr; that
-way, there's a chance that v will now only be used once, and hence
-inlined.
+{- Note [Strict arguments]
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+Consider
+ f (case x of I# y -> e1) e2 e3
+where `f` is strict. It's always good to push the call into the case, giving
+ case x of I# y -> f e1 e2 e3
+But things are much more nuanced when there are /multiple/ alternatives:
+ f (case x of True -> e1a; False -> e1b) e2 e3
+We have to be careful about duplicating e1, e2, but `mkDupableCont` deals with that
+so we /could/ get
+ let a2 = e2; a3 = e3 in
+ case x of { True -> f e1a a2 a3; False -> f e1b a2 a3 }
+This might be good if `f` has rewrite rules, because now it can "see" e1a/e1b. But
+but even then not necessarily -- it can't "see" e2 and e3, unless they are epandable.
+So it is may be better just to leave it as it was, namely
+ f (case x of True -> e1a; False -> e1b) e2 e3
+Strightforward!
+
+To "leave it as it was" means that in `reallyRebuildCase` instead of pushing the
+continuation ito the case branches, just build the case and wrapper the outer
+continuation around it with `rebuild`.
-Historical note: we use to do the "case binder swap" in the Simplifier
-so there were additional complications if the scrutinee was a variable.
-Now the binder-swap stuff is done in the occurrence analyser; see
-"GHC.Core.Opt.OccurAnal" Note [Binder swap].
Note [knownCon occ info]
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -3411,21 +3452,27 @@ simplAlts :: SimplEnv
-> OutExpr -- Scrutinee
-> InId -- Case binder
-> [InAlt] -- Non-empty
- -> SimplCont
+ -> SimplCont -- Precondition: this can be duplicated
-> SimplM OutExpr -- Returns the complete simplified case expression
simplAlts env0 scrut case_bndr alts cont'
= do { traceSmpl "simplAlts" (vcat [ ppr case_bndr
, text "cont':" <+> ppr cont'
, text "in_scope" <+> ppr (seInScope env0) ])
- ; (env1, case_bndr1) <- simplBinder env0 case_bndr
- ; let case_bndr2 = case_bndr1 `setIdUnfolding` evaldUnfolding
- env2 = modifyInScope env1 case_bndr2
+
+ -- hole_scaling: see Note [Scaling in case-of-case]
+ ; let hole_scaling = contHoleScaling cont'
+ case_bndr1 = scaleIdBy hole_scaling case_bndr
+ alts1 = scaleAltsBy hole_scaling alts
+
+ ; (env1, case_bndr2) <- simplBinder env0 case_bndr1
+ ; let case_bndr3 = case_bndr2 `setIdUnfolding` evaldUnfolding
+ env2 = modifyInScope env1 case_bndr3
-- See Note [Case binder evaluated-ness]
fam_envs = seFamEnvs env0
; (alt_env', scrut', case_bndr') <- improveSeq fam_envs env2 scrut
- case_bndr case_bndr2 alts
+ case_bndr case_bndr3 alts1
; (imposs_deflt_cons, in_alts) <- prepareAlts scrut' case_bndr alts
-- NB: it's possible that the returned in_alts is empty: this is handled
@@ -3838,16 +3885,16 @@ join points and inlining them away. See #4930.
-}
--------------------
-mkDupableCaseCont :: SimplEnv -> [InAlt] -> SimplCont
+mkDupableCaseCont :: SimplEnv
+ -> Bool -- True <=> more than one non-bottom alternative
+ -- (result of altsWouldDup)
+ -> SimplCont
-> SimplM ( SimplFloats -- Join points (if any)
, SimplEnv -- Use this for the alts
, SimplCont)
-mkDupableCaseCont env alts cont
- | altsWouldDup alts = do { (floats, cont) <- mkDupableCont env cont
- ; let env' = bumpCaseDepth $
- env `setInScopeFromF` floats
- ; return (floats, env', cont) }
- | otherwise = return (emptyFloats env, env, cont)
+mkDupableCaseCont env alts_would_dup cont
+ | alts_would_dup = mkDupableCont env cont
+ | otherwise = return (emptyFloats env, env, cont)
altsWouldDup :: [InAlt] -> Bool -- True iff strictly > 1 non-bottom alternative
altsWouldDup [] = False -- See Note [Bottom alternatives]
@@ -3867,9 +3914,14 @@ mkDupableCont :: SimplEnv
-> SimplCont
-> SimplM ( SimplFloats -- Incoming SimplEnv augmented with
-- extra let/join-floats and in-scope variables
+ , SimplEnv
, SimplCont) -- dup_cont: duplicable continuation
mkDupableCont env cont
- = mkDupableContWithDmds (zapSubstEnv env) DupSelectToo (repeat topDmd) cont
+ = do { (floats, cont') <- mkDupableContWithDmds (zapSubstEnv env)
+ DupSelectToo (repeat topDmd) cont
+ ; let env' = bumpCaseDepth $
+ env `setInScopeFromF` floats
+ ; return (floats, env', cont') }
mkDupableContWithDmds
:: SimplEnvIS -> DupContFlag
@@ -3960,10 +4012,11 @@ mkDupableContWithDmds env _ _
; mkDupableStrictBind env bndr' join_body res_ty }
-mkDupableContWithDmds env DupSelectToo _
- (StrictArg { sc_fun = fun, sc_cont = cont, sc_fun_ty = fun_ty })
+mkDupableContWithDmds env df _
+ sarg_cont@(StrictArg { sc_fun = fun, sc_cont = app_cont, sc_fun_ty = fun_ty })
-- NB: sc_dup /= OkToDup; that is caught earlier by contIsDupable
- | isNothing (isDataConId_maybe (ai_fun fun))
+ | DupSelectToo <- df
+ , isNothing (isDataConId_maybe (ai_fun fun))
-- isDataConId: see point (DJ4) of Note [Duplicating join points]
= -- Use Plan C of Note [Duplicating StrictArg]
-- StrictArg (f a b <>) : ApplyTo e1 : ApplyTo e2: K
@@ -3975,13 +4028,25 @@ mkDupableContWithDmds env DupSelectToo _
; (floats_s, args') <- mapAndUnzipM (makeTrivialArg env) (ai_args fun)
- ; (floats, cont') <- mkDupableContWithDmds env DupAppsOnly dmds cont
+ ; (floats, app_cont') <- mkDupableContWithDmds env DupAppsOnly dmds app_cont
-- Use the demands from the function to add the right
-- demand info on any bindings we make for further args
; return ( foldl' addLetFloats floats floats_s
, StrictArg { sc_fun = fun { ai_args = args' }
- , sc_cont = cont', sc_dup = OkToDup, sc_fun_ty = fun_ty }) }
+ , sc_cont = app_cont', sc_dup = OkToDup
+ , sc_fun_ty = fun_ty }) }
+
+ | otherwise
+ = -- Use Plan B of Note [Duplicating StrictArg]
+ -- K --> join j x = K[ x ]
+ -- j <>
+ do { let arg_ty = funArgTy fun_ty
+ rhs_ty = contResultType app_cont
+ ; arg_bndr <- newId (fsLit "jarg") ManyTy arg_ty
+ ; let env' = env `addNewInScopeIds` [arg_bndr]
+ ; (floats, join_rhs) <- simplOutId env' arg_bndr sarg_cont
+ ; mkDupableStrictBind env' arg_bndr (wrapFloats floats join_rhs) rhs_ty }
{-
@@ -4037,7 +4102,8 @@ mkDupableContWithDmds env _ _
-- in case [...hole...] of { pi -> ji xij }
-- NB: sc_dup /= OkToDup; that is caught earlier by contIsDupable
do { tick (CaseOfCase case_bndr)
- ; (floats, alt_env, alt_cont) <- mkDupableCaseCont (se `setInScopeFromE` env) alts cont
+ ; (floats, alt_env, alt_cont) <- mkDupableCaseCont (se `setInScopeFromE` env)
+ (altsWouldDup alts) cont
-- NB: We call mkDupableCaseCont here to make cont duplicable
-- (if necessary, depending on the number of alts)
-- And this is important: see Note [Fusing case continuations]
@@ -4072,17 +4138,6 @@ mkDupableContWithDmds env _ _
-- See Note [StaticEnv invariant] in GHC.Core.Opt.Simplify.Utils
, sc_cont = mkBoringStop (contResultType cont) } ) }
-mkDupableContWithDmds env _ _ cont
- = -- Use Plan B of Note [Duplicating StrictArg]
- -- K --> join j x = K[ x ]
- -- j <>
- do { let arg_ty = contHoleType cont
- rhs_ty = contResultType cont
- ; arg_bndr <- newId (fsLit "arg") ManyTy arg_ty
- ; let env' = env `addNewInScopeIds` [arg_bndr]
- ; (floats, join_rhs) <- simplOutId env' arg_bndr cont
- ; mkDupableStrictBind env' arg_bndr (wrapFloats floats join_rhs) rhs_ty }
-
mkDupableStrictBind :: SimplEnv -> OutId -> OutExpr -> OutType
-> SimplM (SimplFloats, SimplCont)
-- mkDupableStrictBind env arg body rhs_ty
=====================================
compiler/GHC/Core/Opt/Simplify/Utils.hs
=====================================
@@ -27,7 +27,7 @@ module GHC.Core.Opt.Simplify.Utils (
contIsTrivial, contArgs, contIsRhs,
countArgs, contOutArgs, dropContArgs,
mkBoringStop, mkRhsStop, mkLazyArgStop,
- interestingCallContext,
+ interestingCallContext, okToDup,
-- ArgInfo
ArgInfo(..), ArgSpec(..), mkArgInfo,
@@ -213,8 +213,8 @@ data SimplCont
, sc_cont :: SimplCont }
| TickIt -- (TickIt t K)[e] = K[ tick t e ]
- CoreTickish -- Tick tickish <hole>
- SimplCont
+ { sc_tick :: CoreTickish -- Tick tickish <hole>
+ , sc_cont :: SimplCont }
data FromWhat = FromLet | FromBeta Levity
@@ -223,6 +223,10 @@ data DupFlag = NoDup -- Unsimplified, might be big
| Simplified -- Simplified
| OkToDup -- Simplified and small
+okToDup :: DupFlag -> Bool
+okToDup OkToDup = True
+okToDup _ = False
+
isSimplified :: DupFlag -> Bool
isSimplified NoDup = False
isSimplified _ = True -- Invariant: the subst-env is empty
@@ -441,13 +445,14 @@ contIsStop (Stop {}) = True
contIsStop _ = False
contIsDupable :: SimplCont -> Bool
-contIsDupable (Stop {}) = True
-contIsDupable (ApplyToTy { sc_cont = k }) = contIsDupable k
-contIsDupable (ApplyToVal { sc_dup = OkToDup }) = True -- See Note [DupFlag invariants]
-contIsDupable (Select { sc_dup = OkToDup }) = True -- ...ditto...
-contIsDupable (StrictArg { sc_dup = OkToDup }) = True -- ...ditto...
-contIsDupable (CastIt { sc_cont = k }) = contIsDupable k
-contIsDupable _ = False
+contIsDupable (Stop {}) = True
+contIsDupable (ApplyToVal { sc_dup = dup }) = okToDup dup -- See Note [DupFlag invariants]
+contIsDupable (Select { sc_dup = dup }) = okToDup dup -- ...ditto...
+contIsDupable (StrictArg { sc_dup = dup }) = okToDup dup -- ...ditto...
+contIsDupable (StrictBind { sc_dup = dup }) = okToDup dup -- ...ditto...
+contIsDupable (ApplyToTy { sc_cont = k }) = contIsDupable k
+contIsDupable (CastIt { sc_cont = k }) = contIsDupable k
+contIsDupable (TickIt { sc_cont = k }) = contIsDupable k
-------------------
contIsTrivial :: SimplCont -> Bool
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/406d6f0cabb257ea4fc56a16ac23701…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/406d6f0cabb257ea4fc56a16ac23701…
You're receiving this email because of your account on gitlab.haskell.org.
1
0