[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 8 commits: Add test case for #25679
by Marge Bot (@marge-bot) 29 Jan '26
by Marge Bot (@marge-bot) 29 Jan '26
29 Jan '26
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
5e0ec555 by sheaf at 2026-01-28T06:56:38-05:00
Add test case for #25679
This commit adds the T25679 test case. The test now passes, thanks to
commit 1e53277af36d3f0b6ad5491f70ffc5593a49dcfd.
Fixes #25679
- - - - -
f1cd1611 by sheaf at 2026-01-28T06:56:38-05:00
Improve defaulting of representational equalities
This commit makes the defaulting of representational equalities, introduced
in 1e53277a, a little bit more robust. Now, instead of calling the eager
unifier, it calls the full-blown constraint solver, which means that it can
handle some subtle situations, e.g. involving functional dependencies and
type-family injectivity annotations, such as:
type family F a = r | r -> a
type instance F Int = Bool
[W] F beta ~R Bool
- - - - -
25edf516 by sheaf at 2026-01-28T06:56:38-05:00
Improve errors for unsolved representational equalities
This commit adds a new field of CtLoc, CtExplanations, which allows the
typechecker to leave some information about what it has done. For the moment,
it is only used to improve error messages for unsolved representational
equalities. The typechecker will now accumulate, when unifying at
representational role:
- out-of-scope newtype constructors,
- type constructors that have nominal role in a certain argument,
- over-saturated type constructors,
- AppTys, e.g. `c a ~R# c b`, to report that we must assume that 'c' has
nominal role in its parameters,
- data family applications that do not reduce, potentially preventing
newtype unwrapping.
Now, instead of having to re-construct the possible errors after the fact,
we simply consult the CtExplanations field.
Additionally, this commit modifies the typechecker error messages that
concern out-of-scope newtype constructors. The error message now depends
on whether we have an import suggestion to provide to the user:
- If we have an import suggestion for the newtype constructor,
the message will be of the form:
The data constructor MkN of the newtype N is out of scope
Suggested fix: add 'MkN' to the import list in the import of 'M'
- If we don't have any import suggestions, the message will be
of the form:
NB: The type 'N' is an opaque newtype, whose constructor is hidden
Fixes #15850, #20289, #20468, #23731, #25949, #26137
- - - - -
4d0e6da1 by Simon Peyton Jones at 2026-01-28T06:57:19-05:00
Fix two bugs in short-cut constraint solving
There are two main changes here:
* Use `isSolvedWC` rather than `isEmptyWC` in `tryShortCutSolver`
The residual constraint may have some fully-solved, but
still-there implications, and we don't want them to abort short
cut solving! That bug caused #26805.
* In the short-cut solver, we abandon the fully-solved residual
constraint; but we may thereby lose track of Givens that are
needed, and either report them as redundant or prune evidence
bindings that are in fact needed.
This bug stopped the `constraints` package from compiling;
see the trail in !15389.
The second bug led me to (another) significant refactoring
of the mechanism for tracking needed EvIds. See the new
Note [Tracking needed EvIds] in GHC.Tc.Solver.Solve
It's simpler and much less head-scratchy now.
Some particulars:
* An EvBindsVar now tracks NeededEvIds
* We deal with NeededEvIds for an implication only when it is
fully solved. Much simpler!
* `tryShortCutTcS` now takes a `TcM WantedConstraints` rather than
`TcM Bool`, so that is can plumb the needed EvIds correctly.
* Remove `ic_need` and `ic_need_implic` from Implication (hooray),
and add `ics_dm` and `ics_non_dm` to `IC_Solved`.
Pure refactor
* Shorten data constructor `CoercionHole` to `CH`, following
general practice in GHC.
* Rename `EvBindMap` to `EvBindsMap` for consistency
- - - - -
662480b7 by Cheng Shao at 2026-01-28T06:58:00-05:00
ci: use debian validate bindists instead of fedora release bindists in testing stage
This patch changes the `abi-test`, `hadrian-multi` and `perf` jobs in
the full-ci pipeline testing stage to use debian validate bindists
instead of fedora release bindists, to increase pipeline level
parallelism and allow full-ci pipelines to complete earlier. Closes #26818.
- - - - -
39581ec6 by Cheng Shao at 2026-01-28T06:58:40-05:00
ci: run perf test with -j$cores
This patch makes the perf ci job compile Cabal with -j$cores to speed
up the job.
- - - - -
607b287b by Wolfgang Jeltsch at 2026-01-28T15:41:53+02:00
Remove `GHC.Desugar` from `base`
`GHC.Desugar` was deprecated and should have been removed in GHC 9.14.
However, the removal was forgotten, although there was a code block that
was intended to trigger a compilation error when the GHC version in use
was 9.14 or later. This code sadly didn’t work, because the
`__GLASGOW_HASKELL__` macro was misspelled as `__GLASGOW_HASKELL`.
- - - - -
249d3c59 by sterni at 2026-01-28T22:48:05-05:00
users_guide: fix runtime error during build with Sphinx 9.1.0
Appears that pathto is stricter about what it accepts now.
Tested Sphinx 8.2.3 and 9.1.0 on the ghc-9.10 branch.
Resolves #26810.
Co-authored-by: Martin Weinelt <hexa(a)darmstadt.ccc.de>
- - - - -
96 changed files:
- .gitlab-ci.yml
- .gitlab/ci.sh
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/FamInstEnv.hs
- compiler/GHC/Core/Predicate.hs
- compiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Core/TyCo/Subst.hs
- compiler/GHC/Core/TyCo/Tidy.hs
- compiler/GHC/Core/TyCon/RecWalk.hs
- compiler/GHC/Data/Maybe.hs
- compiler/GHC/HsToCore/Pmc/Solver.hs
- compiler/GHC/Rename/Unbound.hs
- compiler/GHC/Tc/Errors.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Gen/Default.hs
- compiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Instance/Family.hs
- compiler/GHC/Tc/Solver/Default.hs
- compiler/GHC/Tc/Solver/Dict.hs
- compiler/GHC/Tc/Solver/Equality.hs
- compiler/GHC/Tc/Solver/InertSet.hs
- compiler/GHC/Tc/Solver/Monad.hs
- compiler/GHC/Tc/Solver/Solve.hs
- compiler/GHC/Tc/TyCl/Instance.hs
- compiler/GHC/Tc/Types/Constraint.hs
- compiler/GHC/Tc/Types/CtLoc.hs
- compiler/GHC/Tc/Types/Evidence.hs
- compiler/GHC/Tc/Types/Origin.hs
- compiler/GHC/Tc/Utils/Monad.hs
- compiler/GHC/Tc/Utils/TcMType.hs
- compiler/GHC/Tc/Utils/Unify.hs
- compiler/GHC/Tc/Zonk/TcType.hs
- compiler/GHC/Tc/Zonk/Type.hs
- compiler/GHC/Types/Error/Codes.hs
- compiler/GHC/Types/RepType.hs
- compiler/GHC/Types/Var.hs
- compiler/GHC/Utils/Monad.hs
- compiler/GHC/Utils/Trace.hs
- docs/users_guide/rtd-theme/layout.html
- libraries/base/base.cabal.in
- − libraries/base/src/GHC/Desugar.hs
- libraries/base/tests/T23454.stderr
- + testsuite/tests/default/T25825.hs
- testsuite/tests/default/all.T
- testsuite/tests/deriving/should_fail/T1496.stderr
- testsuite/tests/deriving/should_fail/T4846.stderr
- testsuite/tests/deriving/should_fail/T5498.stderr
- testsuite/tests/deriving/should_fail/T6147.stderr
- testsuite/tests/deriving/should_fail/T7148.stderr
- testsuite/tests/deriving/should_fail/T7148a.stderr
- testsuite/tests/deriving/should_fail/T8984.stderr
- testsuite/tests/deriving/should_fail/deriving-via-fail.stderr
- testsuite/tests/deriving/should_fail/deriving-via-fail4.stderr
- testsuite/tests/deriving/should_fail/deriving-via-fail5.stderr
- testsuite/tests/gadt/CasePrune.stderr
- testsuite/tests/indexed-types/should_fail/T9580.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/linear/should_fail/LinearRole.stderr
- testsuite/tests/roles/should_fail/RolesIArray.stderr
- + testsuite/tests/simplCore/should_compile/T26805.hs
- + testsuite/tests/simplCore/should_compile/T26805.stderr
- testsuite/tests/simplCore/should_compile/all.T
- + testsuite/tests/typecheck/should_compile/T26805a.hs
- testsuite/tests/typecheck/should_compile/all.T
- testsuite/tests/typecheck/should_fail/T10285.stderr
- testsuite/tests/typecheck/should_fail/T10534.stderr
- testsuite/tests/typecheck/should_fail/T10715b.stderr
- testsuite/tests/typecheck/should_fail/T11347.stderr
- testsuite/tests/typecheck/should_fail/T15801.stderr
- + testsuite/tests/typecheck/should_fail/T15850.hs
- + testsuite/tests/typecheck/should_fail/T15850.stderr
- + testsuite/tests/typecheck/should_fail/T15850_Lib.hs
- + testsuite/tests/typecheck/should_fail/T20289.hs
- + testsuite/tests/typecheck/should_fail/T20289.stderr
- + testsuite/tests/typecheck/should_fail/T20289_A.hs
- testsuite/tests/typecheck/should_fail/T22645.stderr
- testsuite/tests/typecheck/should_fail/T22924a.stderr
- + testsuite/tests/typecheck/should_fail/T23731.hs
- + testsuite/tests/typecheck/should_fail/T23731.stderr
- + testsuite/tests/typecheck/should_fail/T23731b.hs
- + testsuite/tests/typecheck/should_fail/T23731b.stderr
- + testsuite/tests/typecheck/should_fail/T23731b_aux.hs
- + testsuite/tests/typecheck/should_fail/T25679.hs
- + testsuite/tests/typecheck/should_fail/T25679.stderr
- + testsuite/tests/typecheck/should_fail/T25949.hs
- + testsuite/tests/typecheck/should_fail/T25949.stderr
- + testsuite/tests/typecheck/should_fail/T25949_aux.hs
- + testsuite/tests/typecheck/should_fail/T26137.hs
- + testsuite/tests/typecheck/should_fail/T26137.stderr
- testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr
- testsuite/tests/typecheck/should_fail/TcCoercibleFail3.stderr
- testsuite/tests/typecheck/should_fail/all.T
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4ff8f907fbaa3fa281d72641aa100e…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4ff8f907fbaa3fa281d72641aa100e…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
Cheng Shao pushed to branch wip/deepseq-primop at Glasgow Haskell Compiler / GHC
Commits:
10ccc7a3 by Cheng Shao at 2026-01-29T03:44:23+01:00
WIP
- - - - -
8 changed files:
- + libraries/ghc-experimental/cbits/DeepSeq.cmm
- libraries/ghc-experimental/ghc-experimental.cabal.in
- + libraries/ghc-experimental/src/GHC/DeepSeq.hs
- testsuite/tests/interface-stability/ghc-experimental-exports.stdout
- testsuite/tests/interface-stability/ghc-experimental-exports.stdout-mingw32
- + testsuite/tests/primops/should_run/DeepSeqPrimOp.hs
- + testsuite/tests/primops/should_run/DeepSeqPrimOp.stdout
- testsuite/tests/primops/should_run/all.T
Changes:
=====================================
libraries/ghc-experimental/cbits/DeepSeq.cmm
=====================================
@@ -0,0 +1,190 @@
+/* -----------------------------------------------------------------------------
+ *
+ * (c) The GHC Team, 2026
+ *
+ * Support for the deepseq# primcall.
+ *
+ * ---------------------------------------------------------------------------*/
+
+#include "Cmm.h"
+
+/* -----------------------------------------------------------------------------
+ deepseq#
+
+ Deeply evaluate a value to (approximate) normal form, without requiring an
+ NFData constraint. This is used to provide a primitive analogue of
+ Control.DeepSeq.force / rnf.
+
+ See the GHC.DeepSeq documentation for the intended semantics and
+ limitations.
+ -------------------------------------------------------------------------- */
+
+// Worker which performs deep evaluation. This lets us tail-call when traversing
+// the final pointer field, avoiding stack blowup on common spine-recursive
+// structures (e.g. lists).
+//
+// The second argument is a boolean (0/1) accumulator tracking whether any
+// evaluation was forced in the transitive closure so far.
+stg_deepseqWorkzh (P_ p, W_ forced)
+{
+ W_ type, info;
+
+ again: MAYBE_GC(again);
+ STK_CHK_GEN();
+
+ p = UNTAG(p);
+ // Values in compact regions are already fully evaluated.
+ (W_ in_compact) = call stg_compactContainsAnyzh(p);
+ if (in_compact != 0) {
+ return (forced);
+ }
+ info = %INFO_PTR(p);
+ type = TO_W_(%INFO_TYPE(%STD_INFO(info)));
+
+ switch [0 .. N_CLOSURE_TYPES] type {
+
+ // Unevaluated things must be evaluated first:
+ case
+ THUNK,
+ THUNK_1_0,
+ THUNK_0_1,
+ THUNK_2_0,
+ THUNK_1_1,
+ THUNK_0_2,
+ THUNK_STATIC,
+ AP,
+ AP_STACK,
+ BLACKHOLE,
+ THUNK_SELECTOR : {
+ (P_ evald) = call %ENTRY_CODE(info) (p);
+ jump stg_deepseqWorkzh(evald, 1);
+ }
+
+ // Follow indirections:
+ case IND, IND_STATIC: {
+ p = %acquire StgInd_indirectee(p);
+ jump stg_deepseqWorkzh(p, forced);
+ }
+
+ // WHITEHOLEs are transient. Yield and try again.
+ case WHITEHOLE: {
+ goto again;
+ }
+
+ // Arrays of pointers: evaluate elements.
+ case
+ MUT_ARR_PTRS_DIRTY,
+ MUT_ARR_PTRS_CLEAN,
+ MUT_ARR_PTRS_FROZEN_DIRTY,
+ MUT_ARR_PTRS_FROZEN_CLEAN: {
+ W_ i_arr, ptrs_arr;
+ ptrs_arr = StgMutArrPtrs_ptrs(p);
+ if (ptrs_arr == 0) { return (forced); }
+ i_arr = ptrs_arr - 1;
+ deepseq_arr_loop0:
+ if (i_arr == 0) {
+ // Tail-call the final element to avoid building up a deep stack
+ // when traversing large immutable arrays.
+ jump stg_deepseqWorkzh(P_[p + SIZEOF_StgMutArrPtrs], forced);
+ }
+ (W_ forced_arr) = call stg_deepseqWorkzh(P_[p + SIZEOF_StgMutArrPtrs + WDS(i_arr)], forced);
+ forced = forced_arr;
+ i_arr = i_arr - 1;
+ goto deepseq_arr_loop0;
+ }
+
+ case
+ SMALL_MUT_ARR_PTRS_DIRTY,
+ SMALL_MUT_ARR_PTRS_CLEAN,
+ SMALL_MUT_ARR_PTRS_FROZEN_DIRTY,
+ SMALL_MUT_ARR_PTRS_FROZEN_CLEAN: {
+ W_ i_sarr, ptrs_sarr;
+ ptrs_sarr = StgSmallMutArrPtrs_ptrs(p);
+ if (ptrs_sarr == 0) { return (forced); }
+ i_sarr = ptrs_sarr - 1;
+ deepseq_arr_loop1:
+ if (i_sarr == 0) {
+ // Tail-call the final element to avoid building up a deep stack
+ // when traversing large immutable arrays.
+ jump stg_deepseqWorkzh(P_[p + SIZEOF_StgSmallMutArrPtrs], forced);
+ }
+ (W_ forced_sarr) = call stg_deepseqWorkzh(P_[p + SIZEOF_StgSmallMutArrPtrs + WDS(i_sarr)], forced);
+ forced = forced_sarr;
+ i_sarr = i_sarr - 1;
+ goto deepseq_arr_loop1;
+ }
+
+ // Constructors: evaluate their pointer fields.
+ case
+ CONSTR,
+ CONSTR_1_0,
+ CONSTR_2_0,
+ CONSTR_1_1,
+ CONSTR_NOCAF: {
+ W_ i_constr, ptrs_constr;
+ ptrs_constr = TO_W_(%INFO_PTRS(%STD_INFO(info)));
+ if (ptrs_constr == 0) { return (forced); }
+ i_constr = 0;
+ deepseq_constr_loop:
+ if (i_constr < ptrs_constr) {
+ // Tail-call the last one. This avoids building up a deep stack
+ // when traversing long lists. We count up so the final pointer
+ // field (e.g. the tail of a list cell) is tail-called.
+ if (i_constr == ptrs_constr - 1) {
+ jump stg_deepseqWorkzh(StgClosure_payload(p,i_constr), forced);
+ }
+ (W_ forced_constr) = call stg_deepseqWorkzh(StgClosure_payload(p,i_constr), forced);
+ forced = forced_constr;
+ i_constr = i_constr + 1;
+ goto deepseq_constr_loop;
+ }
+ return (forced);
+ }
+
+ case
+ MUT_VAR_CLEAN,
+ MUT_VAR_DIRTY: {
+ p = StgMutVar_var(p);
+ jump stg_deepseqWorkzh(p, forced);
+ }
+
+ case
+ MVAR_CLEAN,
+ MVAR_DIRTY: {
+ p = StgMVar_value(p);
+ jump stg_deepseqWorkzh(p, forced);
+ }
+
+ case TVAR: {
+ (P_ tvar_val) = call stg_readTVarIOzh(p);
+ jump stg_deepseqWorkzh(tvar_val, forced);
+ }
+
+ case WEAK: {
+ // Follow the value of a live weak pointer.
+ jump stg_deepseqWorkzh(StgWeak_value(p), forced);
+ }
+
+ // Anything else: conservatively stop.
+ //
+ // This includes (among other closure types) function-like closures, TSOs, etc,
+ // matching the intended "mimic typical NFData instances" semantics
+ // described in the primop documentation.
+ //
+ // We should never see frames here, but if we do, returning is safer than
+ // entering arbitrary things.
+ default: {
+ return (forced);
+ }}
+}
+
+// deepseq# primop entry point.
+// deepseq# :: forall a s. a -> State# s -> (# State# s, Int#, a #)
+//
+// The State# argument/result has no runtime representation, so the RTS entry
+// only takes the value being forced.
+stg_deepseqzh (P_ p)
+{
+ (W_ forced) = call stg_deepseqWorkzh(p, 0);
+ return (forced, p);
+}
=====================================
libraries/ghc-experimental/ghc-experimental.cabal.in
=====================================
@@ -35,6 +35,7 @@ library
exposed-modules:
Data.Sum.Experimental
Data.Tuple.Experimental
+ GHC.DeepSeq
GHC.PrimOps
GHC.Profiling.Eras
GHC.TypeLits.Experimental
@@ -51,4 +52,5 @@ library
build-depends: base >=4.20 && < 4.23,
ghc-internal == @ProjectVersionForLib@.*
hs-source-dirs: src
+ cmm-sources: cbits/DeepSeq.cmm
default-language: Haskell2010
=====================================
libraries/ghc-experimental/src/GHC/DeepSeq.hs
=====================================
@@ -0,0 +1,57 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE GHCForeignImportPrim #-}
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE UnboxedTuples #-}
+{-# LANGUAGE UnliftedFFITypes #-}
+
+module GHC.DeepSeq
+ ( force,
+ forceIO,
+ forceST,
+ )
+where
+
+import GHC.Internal.Exts
+import GHC.Internal.IO
+import GHC.Internal.ST
+
+-- | Pure wrapper around 'forceST'.
+force :: a -> (Bool, a)
+force a = runST (forceST a)
+
+-- | Deeply evaluate a value in the 'IO' monad, returning the forced value and
+-- a flag indicating whether any unevaluated closure was forced.
+--
+-- This is a primitive analogue of 'Control.DeepSeq.force' / @rnf@ that does
+-- not require an 'NFData' constraint. It traverses algebraic data (constructor
+-- fields), immutable arrays, and the contents of 'MutVar#', 'MVar#',
+-- 'MutableArray#', 'SmallMutableArray#', 'TVar#', and live 'Weak#' values.
+--
+-- To mimic typical 'Control.DeepSeq.NFData' instances, it stops at
+-- function-like closures (e.g. functions and partial applications) and at
+-- mutable objects which are not plain containers (e.g. 'MutableByteArray#').
+-- Consequently
+-- it is not a drop-in replacement for user-defined 'NFData' instances, which
+-- may choose to force less (or more) depending on semantics.
+--
+-- === Pointer traversal policy
+--
+-- We only follow a pointer when doing so is also possible in Haskell via a
+-- corresponding API. For example, we traverse 'MutVar#', 'MVar#', mutable
+-- arrays, and live weak pointers because you can observe their contents with
+-- operations like @readIORef@, @readMVar@, @readArray@, or @deRefWeak@.
+-- Conversely, we do not peek inside closures whose internals are not
+-- observable from Haskell, such as function closures and their captured free
+-- variables.
+--
+-- Like any deep evaluation, it may not terminate on cyclic structures.
+forceIO :: a -> IO (Bool, a)
+forceIO a = stToIO (forceST a)
+
+-- | Deeply evaluate a value in the strict 'ST' monad.
+forceST :: a -> ST s (Bool, a)
+forceST a = ST $ \s0 ->
+ case deepseq# (unsafeCoerce# a) s0 of
+ (# s1, flag#, a' #) -> (# s1, (isTrue# flag#, unsafeCoerce# a') #)
+
+foreign import prim "stg_deepseqzh" deepseq# :: Any -> State# s -> (# State# s, Int#, Any #)
=====================================
testsuite/tests/interface-stability/ghc-experimental-exports.stdout
=====================================
@@ -4454,6 +4454,12 @@ module Data.Tuple.Experimental where
data Unit# = ...
getSolo :: forall a. Solo a -> a
+module GHC.DeepSeq where
+ -- Safety: None
+ force :: forall a. a -> (GHC.Internal.Types.Bool, a)
+ forceIO :: forall a. a -> GHC.Internal.Types.IO (GHC.Internal.Types.Bool, a)
+ forceST :: forall a s. a -> GHC.Internal.ST.ST s (GHC.Internal.Types.Bool, a)
+
module GHC.Exception.Backtrace.Experimental where
-- Safety: None
type BacktraceMechanism :: *
=====================================
testsuite/tests/interface-stability/ghc-experimental-exports.stdout-mingw32
=====================================
@@ -4454,6 +4454,12 @@ module Data.Tuple.Experimental where
data Unit# = ...
getSolo :: forall a. Solo a -> a
+module GHC.DeepSeq where
+ -- Safety: None
+ force :: forall a. a -> (GHC.Internal.Types.Bool, a)
+ forceIO :: forall a. a -> GHC.Internal.Types.IO (GHC.Internal.Types.Bool, a)
+ forceST :: forall a s. a -> GHC.Internal.ST.ST s (GHC.Internal.Types.Bool, a)
+
module GHC.Exception.Backtrace.Experimental where
-- Safety: None
type BacktraceMechanism :: *
=====================================
testsuite/tests/primops/should_run/DeepSeqPrimOp.hs
=====================================
@@ -0,0 +1,121 @@
+module Main (main) where
+
+import Control.Concurrent.MVar (MVar, newEmptyMVar, putMVar)
+import Control.Concurrent.STM (TVar, newTVarIO)
+import Control.Exception (SomeException, evaluate, try)
+import Data.Array (Array, listArray)
+import Data.Array.IO (IOArray, newArray)
+import Data.IORef (IORef, newIORef)
+import GHC.DeepSeq (force, forceIO, forceST)
+import GHC.Compact (compactWithSharing, getCompact)
+import GHC.ST (runST)
+import System.Mem.Weak (mkWeak)
+import System.Timeout (timeout)
+
+deepEvaluate :: a -> IO a
+deepEvaluate a = do
+ (_, a') <- forceIO a
+ pure a'
+
+deepEvaluateWithFlag :: a -> IO (Bool, a)
+deepEvaluateWithFlag = forceIO
+
+mkThunk :: Int -> Int
+mkThunk x = x + 1
+{-# NOINLINE mkThunk #-}
+
+boomVal :: Int
+boomVal = error "boom"
+{-# NOINLINE boomVal #-}
+
+funVal :: Int -> Int
+funVal _ = boomVal
+{-# NOINLINE funVal #-}
+
+main :: IO ()
+main = do
+ r1 <- try (deepEvaluate (1 :: Int, error "boom") >> pure ()) :: IO (Either SomeException ())
+ case r1 of
+ Left _ -> putStrLn "thunk-forced"
+ Right _ -> putStrLn "unexpected-no-exn"
+
+ r2 <- try (deepEvaluate funVal) :: IO (Either SomeException (Int -> Int))
+ case r2 of
+ Left _ -> putStrLn "unexpected-exn"
+ Right _ -> putStrLn "fun-ok"
+
+ (forced2, ()) <- deepEvaluateWithFlag ()
+ if not forced2
+ then putStrLn "noforce-ok"
+ else putStrLn "noforce-bad"
+
+ x <- evaluate (42 :: Int)
+ (forced2b, _) <- deepEvaluateWithFlag x
+ if not forced2b
+ then putStrLn "noforce-int-ok"
+ else putStrLn "noforce-int-bad"
+
+ let (forced2c, _) = force x
+ if not forced2c
+ then putStrLn "force-int-ok"
+ else putStrLn "force-int-bad"
+
+ let (forced2d, _) = runST (forceST x)
+ if not forced2d
+ then putStrLn "forcest-int-ok"
+ else putStrLn "forcest-int-bad"
+
+ let v = (1 :: Int, mkThunk 2)
+ (forced3, v') <- deepEvaluateWithFlag v
+ if forced3 && snd v' == 3
+ then putStrLn "thunk-ok"
+ else putStrLn "unexpected"
+
+ let arr :: Array Int Int
+ arr = listArray (0, 0) [boomVal]
+ r3 <- try (deepEvaluate arr >> pure ()) :: IO (Either SomeException ())
+ case r3 of
+ Left _ -> putStrLn "array-thunk-forced"
+ Right _ -> putStrLn "array-unforced"
+
+ ioArr <- newArray (0, 0) boomVal :: IO (IOArray Int Int)
+ r4 <- try (deepEvaluate ioArr >> pure ()) :: IO (Either SomeException ())
+ case r4 of
+ Left _ -> putStrLn "ioarray-thunk-forced"
+ Right _ -> putStrLn "ioarray-unforced"
+
+ ref <- newIORef boomVal :: IO (IORef Int)
+ r5 <- try (deepEvaluate ref >> pure ()) :: IO (Either SomeException ())
+ case r5 of
+ Left _ -> putStrLn "ioref-thunk-forced"
+ Right _ -> putStrLn "ioref-unforced"
+
+ mvar <- newEmptyMVar :: IO (MVar Int)
+ putMVar mvar boomVal
+ r6 <- try (deepEvaluate mvar >> pure ()) :: IO (Either SomeException ())
+ case r6 of
+ Left _ -> putStrLn "mvar-thunk-forced"
+ Right _ -> putStrLn "mvar-unforced"
+
+ tvar <- newTVarIO boomVal :: IO (TVar Int)
+ r6b <- try (deepEvaluate tvar >> pure ()) :: IO (Either SomeException ())
+ case r6b of
+ Left _ -> putStrLn "tvar-thunk-forced"
+ Right _ -> putStrLn "tvar-unforced"
+
+ keyRef <- newIORef ()
+ weak <- mkWeak keyRef boomVal Nothing
+ r7 <- try (deepEvaluate weak >> pure ()) :: IO (Either SomeException ())
+ case r7 of
+ Left _ -> putStrLn "weak-thunk-forced"
+ Right _ -> putStrLn "weak-unforced"
+
+ let cyclic :: [Int]
+ cyclic = let xs = 1 : xs in xs
+ compacted <- compactWithSharing cyclic
+ let cyclic' = getCompact compacted
+ _ <- evaluate cyclic'
+ r8 <- timeout 2000000 (deepEvaluateWithFlag cyclic')
+ case r8 of
+ Nothing -> putStrLn "compact-loop-timeout"
+ Just _ -> putStrLn "compact-loop-ok"
=====================================
testsuite/tests/primops/should_run/DeepSeqPrimOp.stdout
=====================================
@@ -0,0 +1,14 @@
+thunk-forced
+fun-ok
+noforce-ok
+noforce-int-ok
+force-int-ok
+forcest-int-ok
+thunk-ok
+array-thunk-forced
+ioarray-thunk-forced
+ioref-thunk-forced
+mvar-thunk-forced
+tvar-thunk-forced
+weak-thunk-forced
+compact-loop-ok
=====================================
testsuite/tests/primops/should_run/all.T
=====================================
@@ -17,6 +17,7 @@ test('T13825-compile', normal, compile_and_run, [''])
test('T16164', normal, compile_and_run, [''])
test('ShowPrim', normal, compile_and_run, [''])
test('T12492', normal, compile_and_run, [''])
+test('DeepSeqPrimOp', [js_skip, extra_ways(['ghci','ghci-opt']), extra_hc_opts('-package ghc-experimental -package ghc-compact')], compile_and_run, [''])
test('ArithInt8', normal, compile_and_run, [''])
test('ArithWord8', normal, compile_and_run, [''])
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/10ccc7a3712d9b8fa8d62a5d0d61f46…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/10ccc7a3712d9b8fa8d62a5d0d61f46…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/deepseq-primop] 16 commits: ci: remove duplicate keys in .gitlab-ci.yml
by Cheng Shao (@TerrorJack) 29 Jan '26
by Cheng Shao (@TerrorJack) 29 Jan '26
29 Jan '26
Cheng Shao pushed to branch wip/deepseq-primop at Glasgow Haskell Compiler / GHC
Commits:
414b9593 by Cheng Shao at 2026-01-24T07:11:51-05:00
ci: remove duplicate keys in .gitlab-ci.yml
This patch removes accidentally duplicate keys in `.gitlab-ci.yml`.
The YAML spec doesn't allow duplicate keys in the first place, and
according to GitLab docs
(https://docs.gitlab.com/ci/yaml/yaml_optimization/#anchors) the
latest key overrides the earlier entries.
- - - - -
e5cb5491 by Cheng Shao at 2026-01-24T07:12:34-05:00
hadrian: drop obsolete configure/make builder logic for libffi
This patch drops obsolete hadrian logic around `Configure
libffiPath`/`Make libffiPath` builders, they are no longer needed
after libffi-clib has landed. Closes #26815.
- - - - -
2d160222 by Simon Hengel at 2026-01-24T07:13:17-05:00
Fix typo in roles.rst
- - - - -
56db94f7 by Peter Trommler at 2026-01-26T11:26:18+01:00
PPC NCG: Generate clear right insn at arch width
The clear right immediate (clrrxi) is only available in word and
doubleword width. Generate clrrxi instructions at architecture
width for all MachOp widths.
Fixes #24145
- - - - -
5957a8ad by Wolfgang Jeltsch at 2026-01-27T06:11:40-05:00
Add operations for obtaining operating-system handles
This contribution implements CLC proposal #369. It adds operations for
obtaining POSIX file descriptors and Windows handles that underlie
Haskell handles. Those operating system handles can also be obtained
without such additional operations, but this is more involved and, more
importantly, requires using internals.
- - - - -
86a0510c by Greg Steuck at 2026-01-27T06:12:34-05:00
Move flags to precede patterns for grep and read files directly
This makes the tests pass with non-GNU (i.e. POSIX-complicant) tools.
There's no reason to use cat and pipe where direct file argument works.
- - - - -
50761451 by Cheng Shao at 2026-01-27T21:51:23-05:00
ci: update darwin boot ghc to 9.10.3
This patch updates darwin boot ghc to 9.10.3, along with other related
updates, and pays off some technical debt here:
- Update `nixpkgs` and use the `nixpkgs-25.05-darwin` channel.
- Update the `niv` template.
- Update LLVM to 21 and update `llvm-targets` to reflect LLVM 21
layout changes for arm64/x86_64 darwin targets.
- Use `stdenvNoCC` to prevent nix packaged apple sdk from being used
by boot ghc, and manually set `DEVELOPER_DIR`/`SDKROOT` to enforce
the usage of system-wide command line sdk for macos.
- When building nix derivation for boot ghc, run `configure` via the
`arch` command so that `configure` and its subprocesses pick up the
manually specified architecture.
- Remove the previous horrible hack that obliterates `configure` to
make autoconf test result in true. `configure` now properly does its
job.
- Remove the now obsolete configure args and post install settings
file patching logic.
- Use `scheme-small` for texlive to avoid build failures in certain
unused texlive packages, especially on x86_64-darwin.
- - - - -
94dcd15e by Matthew Pickering at 2026-01-27T21:52:05-05:00
Evaluate backtraces for "error" exceptions at the moment they are thrown
See Note [Capturing the backtrace in throw] and
Note [Hiding precise exception signature in throw] which explain the
implementation.
This commit makes `error` and `throw` behave the same with regard to
backtraces. Previously, exceptions raised by `error` would not contain
useful IPE backtraces.
I did try and implement `error` in terms of `throw` but it started to
involve putting diverging functions into hs-boot files, which seemed to
risky if the compiler wouldn't be able to see if applying a function
would diverge.
CLC proposal: https://github.com/haskell/core-libraries-committee/issues/383
Fixes #26751
- - - - -
ef35e3ea by Teo Camarasu at 2026-01-27T21:52:46-05:00
ghc-internal: move all Data instances to Data.Data
Most instances of Data are defined in GHC.Internal.Data.Data.
Let's move all remaining instance there.
This moves other modules down in the dependency hierarchy allowing for
more parallelism, and it decreases the likelihood that we would need to
load this heavy .hi file if we don't actually need it.
Resolves #26830
Metric Decrease:
T12227
T16875
- - - - -
5e0ec555 by sheaf at 2026-01-28T06:56:38-05:00
Add test case for #25679
This commit adds the T25679 test case. The test now passes, thanks to
commit 1e53277af36d3f0b6ad5491f70ffc5593a49dcfd.
Fixes #25679
- - - - -
f1cd1611 by sheaf at 2026-01-28T06:56:38-05:00
Improve defaulting of representational equalities
This commit makes the defaulting of representational equalities, introduced
in 1e53277a, a little bit more robust. Now, instead of calling the eager
unifier, it calls the full-blown constraint solver, which means that it can
handle some subtle situations, e.g. involving functional dependencies and
type-family injectivity annotations, such as:
type family F a = r | r -> a
type instance F Int = Bool
[W] F beta ~R Bool
- - - - -
25edf516 by sheaf at 2026-01-28T06:56:38-05:00
Improve errors for unsolved representational equalities
This commit adds a new field of CtLoc, CtExplanations, which allows the
typechecker to leave some information about what it has done. For the moment,
it is only used to improve error messages for unsolved representational
equalities. The typechecker will now accumulate, when unifying at
representational role:
- out-of-scope newtype constructors,
- type constructors that have nominal role in a certain argument,
- over-saturated type constructors,
- AppTys, e.g. `c a ~R# c b`, to report that we must assume that 'c' has
nominal role in its parameters,
- data family applications that do not reduce, potentially preventing
newtype unwrapping.
Now, instead of having to re-construct the possible errors after the fact,
we simply consult the CtExplanations field.
Additionally, this commit modifies the typechecker error messages that
concern out-of-scope newtype constructors. The error message now depends
on whether we have an import suggestion to provide to the user:
- If we have an import suggestion for the newtype constructor,
the message will be of the form:
The data constructor MkN of the newtype N is out of scope
Suggested fix: add 'MkN' to the import list in the import of 'M'
- If we don't have any import suggestions, the message will be
of the form:
NB: The type 'N' is an opaque newtype, whose constructor is hidden
Fixes #15850, #20289, #20468, #23731, #25949, #26137
- - - - -
4d0e6da1 by Simon Peyton Jones at 2026-01-28T06:57:19-05:00
Fix two bugs in short-cut constraint solving
There are two main changes here:
* Use `isSolvedWC` rather than `isEmptyWC` in `tryShortCutSolver`
The residual constraint may have some fully-solved, but
still-there implications, and we don't want them to abort short
cut solving! That bug caused #26805.
* In the short-cut solver, we abandon the fully-solved residual
constraint; but we may thereby lose track of Givens that are
needed, and either report them as redundant or prune evidence
bindings that are in fact needed.
This bug stopped the `constraints` package from compiling;
see the trail in !15389.
The second bug led me to (another) significant refactoring
of the mechanism for tracking needed EvIds. See the new
Note [Tracking needed EvIds] in GHC.Tc.Solver.Solve
It's simpler and much less head-scratchy now.
Some particulars:
* An EvBindsVar now tracks NeededEvIds
* We deal with NeededEvIds for an implication only when it is
fully solved. Much simpler!
* `tryShortCutTcS` now takes a `TcM WantedConstraints` rather than
`TcM Bool`, so that is can plumb the needed EvIds correctly.
* Remove `ic_need` and `ic_need_implic` from Implication (hooray),
and add `ics_dm` and `ics_non_dm` to `IC_Solved`.
Pure refactor
* Shorten data constructor `CoercionHole` to `CH`, following
general practice in GHC.
* Rename `EvBindMap` to `EvBindsMap` for consistency
- - - - -
662480b7 by Cheng Shao at 2026-01-28T06:58:00-05:00
ci: use debian validate bindists instead of fedora release bindists in testing stage
This patch changes the `abi-test`, `hadrian-multi` and `perf` jobs in
the full-ci pipeline testing stage to use debian validate bindists
instead of fedora release bindists, to increase pipeline level
parallelism and allow full-ci pipelines to complete earlier. Closes #26818.
- - - - -
39581ec6 by Cheng Shao at 2026-01-28T06:58:40-05:00
ci: run perf test with -j$cores
This patch makes the perf ci job compile Cabal with -j$cores to speed
up the job.
- - - - -
53681e5a by Cheng Shao at 2026-01-29T03:30:57+01:00
WIP
- - - - -
141 changed files:
- .gitlab-ci.yml
- .gitlab/ci.sh
- .gitlab/darwin/nix/sources.json
- .gitlab/darwin/toolchain.nix
- compiler/GHC/CmmToAsm/PPC/CodeGen.hs
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/FamInstEnv.hs
- compiler/GHC/Core/Predicate.hs
- compiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Core/TyCo/Subst.hs
- compiler/GHC/Core/TyCo/Tidy.hs
- compiler/GHC/Core/TyCon/RecWalk.hs
- compiler/GHC/Data/Maybe.hs
- compiler/GHC/HsToCore/Pmc/Solver.hs
- compiler/GHC/Rename/Unbound.hs
- compiler/GHC/Tc/Errors.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Gen/Default.hs
- compiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Instance/Family.hs
- compiler/GHC/Tc/Solver/Default.hs
- compiler/GHC/Tc/Solver/Dict.hs
- compiler/GHC/Tc/Solver/Equality.hs
- compiler/GHC/Tc/Solver/InertSet.hs
- compiler/GHC/Tc/Solver/Monad.hs
- compiler/GHC/Tc/Solver/Solve.hs
- compiler/GHC/Tc/TyCl/Instance.hs
- compiler/GHC/Tc/Types/Constraint.hs
- compiler/GHC/Tc/Types/CtLoc.hs
- compiler/GHC/Tc/Types/Evidence.hs
- compiler/GHC/Tc/Types/Origin.hs
- compiler/GHC/Tc/Utils/Monad.hs
- compiler/GHC/Tc/Utils/TcMType.hs
- compiler/GHC/Tc/Utils/Unify.hs
- compiler/GHC/Tc/Zonk/TcType.hs
- compiler/GHC/Tc/Zonk/Type.hs
- compiler/GHC/Types/Error/Codes.hs
- compiler/GHC/Types/RepType.hs
- compiler/GHC/Types/Var.hs
- compiler/GHC/Utils/Monad.hs
- compiler/GHC/Utils/Trace.hs
- docs/users_guide/exts/roles.rst
- hadrian/src/Context.hs
- hadrian/src/Settings/Builders/Configure.hs
- hadrian/src/Settings/Builders/Make.hs
- libraries/base/base.cabal.in
- libraries/base/changelog.md
- + libraries/base/src/System/IO/OS.hs
- libraries/base/tests/IO/all.T
- + libraries/base/tests/IO/osHandles001FileDescriptors.hs
- + libraries/base/tests/IO/osHandles001FileDescriptors.stdout
- + libraries/base/tests/IO/osHandles001WindowsHandles.hs
- + libraries/base/tests/IO/osHandles001WindowsHandles.stdout
- + libraries/base/tests/IO/osHandles002FileDescriptors.hs
- + libraries/base/tests/IO/osHandles002FileDescriptors.stderr
- + libraries/base/tests/IO/osHandles002FileDescriptors.stdin
- + libraries/base/tests/IO/osHandles002FileDescriptors.stdout
- + libraries/base/tests/IO/osHandles002WindowsHandles.hs
- + libraries/base/tests/IO/osHandles002WindowsHandles.stderr
- + libraries/base/tests/IO/osHandles002WindowsHandles.stdin
- + libraries/base/tests/IO/osHandles002WindowsHandles.stdout
- libraries/base/tests/T23454.stderr
- libraries/base/tests/perf/Makefile
- + libraries/ghc-experimental/cbits/DeepSeq.cmm
- libraries/ghc-experimental/ghc-experimental.cabal.in
- + libraries/ghc-experimental/src/GHC/DeepSeq.hs
- libraries/ghc-internal/ghc-internal.cabal.in
- libraries/ghc-internal/src/GHC/Internal/Data/Data.hs
- libraries/ghc-internal/src/GHC/Internal/Err.hs
- libraries/ghc-internal/src/GHC/Internal/Exts.hs
- libraries/ghc-internal/src/GHC/Internal/Functor/ZipList.hs
- + libraries/ghc-internal/src/GHC/Internal/System/IO/OS.hs
- libraries/ghc-internal/tests/stack-annotation/all.T
- + libraries/ghc-internal/tests/stack-annotation/ann_frame005.hs
- + libraries/ghc-internal/tests/stack-annotation/ann_frame005.stdout
- llvm-targets
- + testsuite/tests/default/T25825.hs
- testsuite/tests/default/all.T
- testsuite/tests/deriving/should_fail/T1496.stderr
- testsuite/tests/deriving/should_fail/T4846.stderr
- testsuite/tests/deriving/should_fail/T5498.stderr
- testsuite/tests/deriving/should_fail/T6147.stderr
- testsuite/tests/deriving/should_fail/T7148.stderr
- testsuite/tests/deriving/should_fail/T7148a.stderr
- testsuite/tests/deriving/should_fail/T8984.stderr
- testsuite/tests/deriving/should_fail/deriving-via-fail.stderr
- testsuite/tests/deriving/should_fail/deriving-via-fail4.stderr
- testsuite/tests/deriving/should_fail/deriving-via-fail5.stderr
- testsuite/tests/driver/T16318/Makefile
- testsuite/tests/driver/T18125/Makefile
- testsuite/tests/gadt/CasePrune.stderr
- testsuite/tests/ghci.debugger/scripts/T8487.stdout
- testsuite/tests/ghci.debugger/scripts/break011.stdout
- testsuite/tests/ghci.debugger/scripts/break017.stdout
- testsuite/tests/ghci.debugger/scripts/break025.stdout
- testsuite/tests/indexed-types/should_fail/T9580.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/interface-stability/ghc-experimental-exports.stdout
- testsuite/tests/interface-stability/ghc-experimental-exports.stdout-mingw32
- testsuite/tests/linear/should_fail/LinearRole.stderr
- + testsuite/tests/primops/should_run/DeepSeqPrimOp.hs
- + testsuite/tests/primops/should_run/DeepSeqPrimOp.stdout
- testsuite/tests/primops/should_run/all.T
- testsuite/tests/roles/should_fail/RolesIArray.stderr
- + testsuite/tests/simplCore/should_compile/T26805.hs
- + testsuite/tests/simplCore/should_compile/T26805.stderr
- testsuite/tests/simplCore/should_compile/all.T
- + testsuite/tests/typecheck/should_compile/T26805a.hs
- testsuite/tests/typecheck/should_compile/all.T
- testsuite/tests/typecheck/should_fail/T10285.stderr
- testsuite/tests/typecheck/should_fail/T10534.stderr
- testsuite/tests/typecheck/should_fail/T10715b.stderr
- testsuite/tests/typecheck/should_fail/T11347.stderr
- testsuite/tests/typecheck/should_fail/T15801.stderr
- + testsuite/tests/typecheck/should_fail/T15850.hs
- + testsuite/tests/typecheck/should_fail/T15850.stderr
- + testsuite/tests/typecheck/should_fail/T15850_Lib.hs
- + testsuite/tests/typecheck/should_fail/T20289.hs
- + testsuite/tests/typecheck/should_fail/T20289.stderr
- + testsuite/tests/typecheck/should_fail/T20289_A.hs
- testsuite/tests/typecheck/should_fail/T22645.stderr
- testsuite/tests/typecheck/should_fail/T22924a.stderr
- + testsuite/tests/typecheck/should_fail/T23731.hs
- + testsuite/tests/typecheck/should_fail/T23731.stderr
- + testsuite/tests/typecheck/should_fail/T23731b.hs
- + testsuite/tests/typecheck/should_fail/T23731b.stderr
- + testsuite/tests/typecheck/should_fail/T23731b_aux.hs
- + testsuite/tests/typecheck/should_fail/T25679.hs
- + testsuite/tests/typecheck/should_fail/T25679.stderr
- + testsuite/tests/typecheck/should_fail/T25949.hs
- + testsuite/tests/typecheck/should_fail/T25949.stderr
- + testsuite/tests/typecheck/should_fail/T25949_aux.hs
- + testsuite/tests/typecheck/should_fail/T26137.hs
- + testsuite/tests/typecheck/should_fail/T26137.stderr
- testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr
- testsuite/tests/typecheck/should_fail/TcCoercibleFail3.stderr
- testsuite/tests/typecheck/should_fail/all.T
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/50f8212ee9491e09ef642718bc3718…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/50f8212ee9491e09ef642718bc3718…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/T24464] 68 commits: Add evals for strict data-con args in worker-functions
by Simon Peyton Jones (@simonpj) 29 Jan '26
by Simon Peyton Jones (@simonpj) 29 Jan '26
29 Jan '26
Simon Peyton Jones pushed to branch wip/T24464 at Glasgow Haskell Compiler / GHC
Commits:
c56567ec by Simon Peyton Jones at 2026-01-15T23:19:04+00:00
Add evals for strict data-con args in worker-functions
This fixes #26722, by adding an eval in a worker for
arguments of strict data constructors, even if the
function body uses them strictly.
See (WIS1) in Note [Which Ids should be strictified]
I took the opportunity to make substantial improvements in the
documentation for call-by-value functions. See especially
Note [CBV Function Ids: overview] in GHC.Types.Id.Info
Note [Which Ids should be CBV candidates?] ditto
Note [EPT enforcement] in GHC.Stg.EnforceEpt
among others.
- - - - -
9719ce5d by Simon Peyton Jones at 2026-01-15T23:19:04+00:00
Improve `interestingArg`
This function analyses a function's argument to see if it is
interesting enough to deserve an inlining discount. Improvements
for
* LitRubbish arguments
* exprIsExpandable arguments
See Note [Interesting arguments] which is substantially rewritten.
- - - - -
7b616b9f by Cheng Shao at 2026-01-16T06:45:00-05:00
compiler: fix regression when compiling foreign stubs in the rts unit
This patch fixes a regression when compiling foreign stubs in the rts
unit introduced in 05e25647f72bc102061af3f20478aa72bff6ff6e. A simple
revert would fix it, but it's better to implement a proper fix with
comment for better understanding of the underlying problem, see the
added comment for explanation.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
c343ef64 by Sylvain Henry at 2026-01-16T06:45:51-05:00
base: remove GHC.JS.Prim.Internal.Build (#23432)
See accepted CLC proposal https://github.com/haskell/core-libraries-committee/issues/329
- - - - -
29c0aceb by Simon Peyton Jones at 2026-01-16T17:18:11-05:00
Improve newtype unwrapping
Ticket #26746 describes several relatively-minor shortcomings of newtype
unwrapping. This MR addresses them, while also (arguably) simplifying
the code a bit.
See new Note [Solving newtype equalities: overview]
and Note [Decomposing newtype equalities]
and Note [Eager newtype decomposition]
and Note [Even more eager newtype decomposition]
For some reason, on Windows only, runtime allocations decrease for test
T5205 (from 52k to 48k). I have not idea why. No change at all on Linux.
I'm just going to accept the change. (I saw this same effect in another
MR so I think it's a fault in the baseline.)
Metric Decrease:
T5205
- - - - -
8b59e62c by Andreas Klebinger at 2026-01-16T17:18:52-05:00
testsuite: Widen acceptance window for T5205.
Fixes #26782
- - - - -
9e5e0234 by mangoiv at 2026-01-17T06:03:03-05:00
add a new issue template for getting verified
To reduce spam created by new users, we will in future not grant
any rights but reporting issues to new users. That is why we will
have to be able to verify them. The added issue template serves that
purpose.
- - - - -
b18b2c42 by Cheng Shao at 2026-01-17T06:03:44-05:00
llvm: fix split sections for llvm backend
This patch fixes split sections for llvm backend:
- Pass missing `--data-sections`/`--function-sections` flags to
llc/opt.
- Use `(a)llvm.compiler.used` instead of `(a)llvm.used` to avoid sections
being unnecessarily retained at link-time.
Fixes #26770.
-------------------------
Metric Decrease:
libdir
size_hello_artifact
size_hello_unicode
-------------------------
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
ebf66f67 by Cheng Shao at 2026-01-17T13:16:50-05:00
Update autoconf scripts
Scripts taken from autoconf a2287c3041a3f2a204eb942e09c015eab00dc7dd
- - - - -
598624b9 by Andreas Klebinger at 2026-01-17T13:17:32-05:00
CString.hs: Update incorrect comment.
Fixes #26322
- - - - -
eea2036b by Cheng Shao at 2026-01-18T10:00:49-05:00
libraries: bump haskeline submodule to 0.8.4.1
This patch bumps the haskeline submodule to 0.8.4.1 which includes an
important fix for an ANSI handling bug on Windows
(https://github.com/haskell/haskeline/pull/126)
- - - - -
87d8f6c2 by Cheng Shao at 2026-01-18T10:01:30-05:00
hadrian: replace default -H32m/-H64m with -O64M to improve mutator productivity
Most hadrian build flavours pass `-H32m`/`-H64m` to GHC as
conventional wisdom to improve mutator productivity and reduce GC
overhead. They were inherited from the legacy Make build system, and
there used to be make flags to instrument a build process with
`-Rghc-timing` option to collect GC stats of each GHC run from stderr.
It's time to revisit whether there are better defaults for
`-H32m`/`-H64m`, and this patch changes it to `-O64M` which indeed
improves mutator productivity based on real statistics. `-O64M` is
more aggressive than `-H64m`; it allows the old generation to grow to
at least 64M before triggering major GC and reduces major GC runs.
The stats of a clean build with `validate` flavour and `-H64m`:
```
h64m.log
matched RTS stat lines: 5499
sum MUT cpu : 2400.808 s
sum GC cpu : 1378.292 s
sum MUT elapsed : 2788.253 s
sum GC elapsed : 1389.233 s
GC/MUT cpu ratio : 0.574 (GC is 57.4% of MUT)
GC/MUT elapsed ratio : 0.498 (GC is 49.8% of MUT)
GC fraction of (MUT+GC) cpu : 36.5%
GC fraction of (MUT+GC) elapsed : 33.3%
per-line GC/MUT cpu ratio: median 0.691, p90 1.777
per-line GC/MUT elapsed ratio: median 0.519, p90 1.081
```
The stats of a clean build with `validate` flavour and `-O64M`:
```
o64m.log
matched RTS stat lines: 5499
sum MUT cpu : 2377.383 s
sum GC cpu : 1127.146 s
sum MUT elapsed : 2758.857 s
sum GC elapsed : 1135.587 s
GC/MUT cpu ratio : 0.474 (GC is 47.4% of MUT)
GC/MUT elapsed ratio : 0.412 (GC is 41.2% of MUT)
GC fraction of (MUT+GC) cpu : 32.2%
GC fraction of (MUT+GC) elapsed : 29.2%
per-line GC/MUT cpu ratio: median 0.489, p90 1.099
per-line GC/MUT elapsed ratio: median 0.367, p90 0.806
```
Mutator time is roughly in the same ballpark, but GC CPU time has
reduced by 18.22%, and mutator productivity has increased from 63.5%
to 67.8%.
- - - - -
8372e13d by Cheng Shao at 2026-01-18T10:02:12-05:00
rts: remove unused .def files from rts/win32
This patch removes unused .def files from `rts/win32`, given we don't
build .dll files for rts/ghc-internal/ghc-prim at all. Even when we
resurrect win32 dll support at some point in the future, these .def
files still contain incorrect symbols anyway and won't be of any use.
- - - - -
f6af485d by Cheng Shao at 2026-01-18T10:03:19-05:00
.gitmodules: use gitlab mirror for the libffi-clib submodule
This patch fixes .gitmodules to use the gitlab mirror for the
libffi-clib submodule, to make it coherent with other submodules that
allow ghc developers to experiment with wip branches in submodules for
ghc patches. Fixes #26783.
- - - - -
41432d25 by Cheng Shao at 2026-01-18T10:05:13-05:00
hadrian: remove the horrible i386 speedHack
When hadrian builds certain rts objects for i386, there's a horrible
speedHack that forces -fno-PIC even for dynamic ways of those objects.
This is not compatible with newer versions of gcc/binutils as well as
clang/lld, and this patch removes it. Fixes #26792.
- - - - -
323eb8f0 by Cheng Shao at 2026-01-18T21:48:19-05:00
hadrian: enable split sections for cross stage0
This patch fixes a minor issue with `splitSectionsArgs` in hadrian:
previously, it's unconditionally disabled for stage0 libraries because
it's not going to be shipped in the final bindists. But it's only true
when not cross compiling. So for now we also need to enable it for
cross stage0 as well.
- - - - -
3fadfefe by Andreas Klebinger at 2026-01-18T21:49:01-05:00
RTS: Document -K behaviour better
- - - - -
30f442a9 by Teo Camarasu at 2026-01-20T13:57:26-05:00
base: don't expose GHC.Num.{BigNat, Integer, Natural}
We no longer expose GHC.Num.{BigNat, Integer, Natural} from base instead users should get these modules from ghc-bignum.
We make this change to insulate end users from changes to GHC's implementation of big numbers.
Implements CLC proposal 359: https://github.com/haskell/core-libraries-committee/issues/359
- - - - -
75a9053d by Teo Camarasu at 2026-01-20T13:58:07-05:00
base: deprecate GHC internals in GHC.Num
Implements CLC proposal: https://github.com/haskell/core-libraries-committee/issues/360
- - - - -
9534b032 by Andreas Klebinger at 2026-01-20T13:58:50-05:00
ghc-experimental: Update Changelog
I tried to reconstruct a high level overview of the changes and when
they were made since we introduced it.
Fixes #26506
Co-authored-by: Teo Camarasu <teofilcamarasu(a)gmail.com>
- - - - -
346f2f5a by Cheng Shao at 2026-01-20T13:59:30-05:00
hadrian: remove RTS options in ghc-in-ghci flavour
This patch removes the RTS options passed to ghc in ghc-in-ghci
flavour, to workaround command line argument handling issue in
hls/hie-boot that results in `-O64M` instead of `+RTS -O64M -RTS`
being passed to ghc. It's not a hadrian bug per se, since ghc's own
ghc-in-ghci multi repl works fine, but we should still make sure HLS
works. Closes #26801.
- - - - -
759fd15a by Andreas Klebinger at 2026-01-21T16:05:28-05:00
Don't build GHC with -Wcompat
Without bumping the boot compiler the warnings it produces are often not
actionable leading to pointless noise.
Fixes #26800
- - - - -
3172db94 by Torsten Schmits at 2026-01-21T16:06:11-05:00
Use the correct field of ModOrigin when formatting error message listing hidden reexports
- - - - -
485c12b2 by Cheng Shao at 2026-01-21T16:06:54-05:00
Revert "hadrian: handle findExecutable "" gracefully"
This reverts commit 1e5752f64a522c4025365856d92f78073a7b3bba. The
underlying issue has been fixed in
https://github.com/haskell/directory/commit/75828696e7145adc09179111a0d631b…
and present since 1.3.9.0, and hadrian directory lower bound is
1.3.9.0, so we can revert our own in house hack now.
- - - - -
5efb58dc by Cheng Shao at 2026-01-21T16:07:36-05:00
rts: fix typo in TICK_ALLOC_RTS
This patch fixes a typo in the `TICK_ALLOC_RTS` macro, the original
`bytes` argument was silently dropped. The Cmm code has its own
version of `TICK_ALLOC_RTS` not affected by this typo, it affected the
C RTS, and went unnoticed because the variable `n` happened to also be
available at its call site. But the number was incorrect. Also fixes
its call site since `WDS()` is not available in C.
- - - - -
c406ea69 by Cheng Shao at 2026-01-21T16:07:36-05:00
rts: remove broken & unused ALLOC_P_TICKY
This patch removes the `ALLOC_P_TICKY` macro from the rts, it's
unused, and its expanded code is already broken.
- - - - -
34a27e20 by Simon Peyton Jones at 2026-01-21T16:08:17-05:00
Make the implicit-parameter class have representational role
This MR addresses #26737, by making the built-in class IP
have a representational role for its second parameter.
See Note [IP: implicit parameter class] in
ghc-internal:GHC.Internal.Classes.IP
In fact, IP is (unfortunately, currently) exposed by
base:GHC.Base, so we ran a quick CLC proposal to
agree the change:
https://github.com/haskell/core-libraries-committee/issues/385
Some (small) compilations get faster because they only need to
load (small) interface file GHC.Internal.Classes.IP.hi,
rather than (large) GHC.Internal.Classes.hi.
Metric Decrease:
T10421
T12150
T12425
T24582
T5837
T5030
- - - - -
ca79475f by Cheng Shao at 2026-01-21T16:09:00-05:00
testsuite: avoid re.sub in favor of simple string replacements
This patch refactors the testsuite driver and avoids the usage of
re.sub in favor of simple string replacements when possible. The
changes are not comprehensive, and there are still a lot of re.sub
usages lingering around the tree, but this already addresses a major
performance bottleneck in the testsuite driver that might has to do
with quadratic or worse slowdown in cpython's regular expression
engine when handling certain regex patterns with large strings.
Especially on i386, and i386 jobs are the bottlenecks of all full-ci
validate pipelines!
Here are the elapsed times of testing x86_64/i386 with -j48 before
this patch:
x86_64: `Build completed in 6m06s`
i386: `Build completed in 1h36m`
And with this patch:
x86_64: `Build completed in 4m55s`
i386: `Build completed in 4m23s`
Fixes #26786.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
88c93796 by Zubin Duggal at 2026-01-21T16:09:42-05:00
ghc-toolchain: Also configure windres on non-windows platforms.
It may be needed for cross compilation.
Fixes #24588
- - - - -
9788c0ec by Cheng Shao at 2026-01-21T16:10:24-05:00
ghci: print external interpreter trace messages to stderr instead of stdout
This patch makes ghci print external interpreter trace messages to
stderr instead of stdout, which is a much saner choice for diagnostic
information. Closes #26807.
- - - - -
0491f08a by Sylvain Henry at 2026-01-22T03:44:26-05:00
GC: don't use CAS without PARALLEL_GC on
If we're not using the parallel GC, there is no reason to do a costly
CAS. This was flagged as taking time in a perf profile.
- - - - -
211a8f56 by Sylvain Henry at 2026-01-22T03:44:26-05:00
GC: suffix parallel GC with "par" instead of "thr"
Avoid some potential confusion (see discussion in !15351).
- - - - -
77a23cbd by fendor at 2026-01-22T03:45:08-05:00
Remove blanket ignore that covers libraries/
- - - - -
18bf7f5c by Léana Jiang at 2026-01-22T08:58:45-05:00
doc: update Flavour type in hadrian user-settings
- - - - -
3d5a1365 by Cheng Shao at 2026-01-22T08:59:28-05:00
hadrian: add missing notCross predicate for stage0 -O0
There are a few hard-coded hadrian args that pass -O0 when compiling
some heavy modules in stage0, which only makes sense when not
cross-compiling and when cross-compiling we need properly optimized
stage0 packages. So this patch adds the missing `notCross` predicate
in those places.
- - - - -
ee937134 by Matthew Pickering at 2026-01-22T09:00:10-05:00
Fix ghc-experimental GHC.Exception.Backtrace.Experimental module
This module wasn't added to the cabal file so it was never compiled or
included in the library.
- - - - -
1b490f5a by Zubin Duggal at 2026-01-22T09:00:53-05:00
hadrian: Add ghc-{experimental,internal}.cabal to the list of dependencies of the doc target
We need these files to detect the version of these libraries
Fixes #26738
- - - - -
cdb74049 by Cheng Shao at 2026-01-22T14:52:36-05:00
rts: avoid Cmm loop to initialize Array#/SmallArray#
Previously, `newArray#`/`newSmallArray#` called an RTS C function to
allocate the `Array#`/`SmallArray#`, then used a Cmm loop to
initialize the elements. Cmm doesn't have native for-loop so the code
is a bit awkward, and it's less efficient than a C loop, since the C
compiler can effectively vectorize the loop with optimizations.
So this patch moves the loop that initializes the elements to the C
side. `allocateMutArrPtrs`/`allocateSmallMutArrPtrs` now takes a new
`init` argument and initializes the elements if `init` is non-NULL.
- - - - -
4c784f00 by Cheng Shao at 2026-01-22T14:53:19-05:00
Fix testsuite run for +ipe flavour transformer
This patch makes the +ipe flavour transformer pass the entire
testsuite:
- An RTS debug option `-DI` is added, the IPE trace information is now
only printed with `-DI`. The test cases that do require IPE trace
are now run with `-DI`.
- The testsuite config option `ghc_with_ipe` is added, enabled when
running the testsuite with `+ipe`, which skips a few tests that are
sensitive to eventlog output, allocation patterns etc that can fail
under `+ipe`.
This is the first step towards #26799.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
be8e5236 by Ben Gamari at 2026-01-23T03:28:45-05:00
hadrian: Bump QuickCheck upper bound
This patch bumps QuickCheck upper bound to 2.18. selftest rule
manually tested to work with current latest QuickCheck-2.17.1.0.
- - - - -
5aa328fb by Zubin Duggal at 2026-01-23T03:29:30-05:00
Add genindex to index.rst. This adds a link to the index in the navigation bar.
Fixes #26437
- - - - -
917ab8ff by Oleg Grenrus at 2026-01-23T10:52:55-05:00
Export labelThread from Control.Concurrent
- - - - -
3f5e8d80 by Cheng Shao at 2026-01-23T10:53:37-05:00
ci: only push perf notes on master/release branches
This patch fixes push_perf_notes logic in ci.sh to only push perf
notes on master/release branches. We used to unconditionally push perf
notes even in MRs, but the perf numbers in the wip branches wouldn't
be used as baseline anyway, plus this is causing a space leak in the
ghc-performance-notes repo. See #25317 for the perf notes repo size
problem.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
414b9593 by Cheng Shao at 2026-01-24T07:11:51-05:00
ci: remove duplicate keys in .gitlab-ci.yml
This patch removes accidentally duplicate keys in `.gitlab-ci.yml`.
The YAML spec doesn't allow duplicate keys in the first place, and
according to GitLab docs
(https://docs.gitlab.com/ci/yaml/yaml_optimization/#anchors) the
latest key overrides the earlier entries.
- - - - -
e5cb5491 by Cheng Shao at 2026-01-24T07:12:34-05:00
hadrian: drop obsolete configure/make builder logic for libffi
This patch drops obsolete hadrian logic around `Configure
libffiPath`/`Make libffiPath` builders, they are no longer needed
after libffi-clib has landed. Closes #26815.
- - - - -
2d160222 by Simon Hengel at 2026-01-24T07:13:17-05:00
Fix typo in roles.rst
- - - - -
56db94f7 by Peter Trommler at 2026-01-26T11:26:18+01:00
PPC NCG: Generate clear right insn at arch width
The clear right immediate (clrrxi) is only available in word and
doubleword width. Generate clrrxi instructions at architecture
width for all MachOp widths.
Fixes #24145
- - - - -
5957a8ad by Wolfgang Jeltsch at 2026-01-27T06:11:40-05:00
Add operations for obtaining operating-system handles
This contribution implements CLC proposal #369. It adds operations for
obtaining POSIX file descriptors and Windows handles that underlie
Haskell handles. Those operating system handles can also be obtained
without such additional operations, but this is more involved and, more
importantly, requires using internals.
- - - - -
86a0510c by Greg Steuck at 2026-01-27T06:12:34-05:00
Move flags to precede patterns for grep and read files directly
This makes the tests pass with non-GNU (i.e. POSIX-complicant) tools.
There's no reason to use cat and pipe where direct file argument works.
- - - - -
50761451 by Cheng Shao at 2026-01-27T21:51:23-05:00
ci: update darwin boot ghc to 9.10.3
This patch updates darwin boot ghc to 9.10.3, along with other related
updates, and pays off some technical debt here:
- Update `nixpkgs` and use the `nixpkgs-25.05-darwin` channel.
- Update the `niv` template.
- Update LLVM to 21 and update `llvm-targets` to reflect LLVM 21
layout changes for arm64/x86_64 darwin targets.
- Use `stdenvNoCC` to prevent nix packaged apple sdk from being used
by boot ghc, and manually set `DEVELOPER_DIR`/`SDKROOT` to enforce
the usage of system-wide command line sdk for macos.
- When building nix derivation for boot ghc, run `configure` via the
`arch` command so that `configure` and its subprocesses pick up the
manually specified architecture.
- Remove the previous horrible hack that obliterates `configure` to
make autoconf test result in true. `configure` now properly does its
job.
- Remove the now obsolete configure args and post install settings
file patching logic.
- Use `scheme-small` for texlive to avoid build failures in certain
unused texlive packages, especially on x86_64-darwin.
- - - - -
94dcd15e by Matthew Pickering at 2026-01-27T21:52:05-05:00
Evaluate backtraces for "error" exceptions at the moment they are thrown
See Note [Capturing the backtrace in throw] and
Note [Hiding precise exception signature in throw] which explain the
implementation.
This commit makes `error` and `throw` behave the same with regard to
backtraces. Previously, exceptions raised by `error` would not contain
useful IPE backtraces.
I did try and implement `error` in terms of `throw` but it started to
involve putting diverging functions into hs-boot files, which seemed to
risky if the compiler wouldn't be able to see if applying a function
would diverge.
CLC proposal: https://github.com/haskell/core-libraries-committee/issues/383
Fixes #26751
- - - - -
ef35e3ea by Teo Camarasu at 2026-01-27T21:52:46-05:00
ghc-internal: move all Data instances to Data.Data
Most instances of Data are defined in GHC.Internal.Data.Data.
Let's move all remaining instance there.
This moves other modules down in the dependency hierarchy allowing for
more parallelism, and it decreases the likelihood that we would need to
load this heavy .hi file if we don't actually need it.
Resolves #26830
Metric Decrease:
T12227
T16875
- - - - -
5e0ec555 by sheaf at 2026-01-28T06:56:38-05:00
Add test case for #25679
This commit adds the T25679 test case. The test now passes, thanks to
commit 1e53277af36d3f0b6ad5491f70ffc5593a49dcfd.
Fixes #25679
- - - - -
f1cd1611 by sheaf at 2026-01-28T06:56:38-05:00
Improve defaulting of representational equalities
This commit makes the defaulting of representational equalities, introduced
in 1e53277a, a little bit more robust. Now, instead of calling the eager
unifier, it calls the full-blown constraint solver, which means that it can
handle some subtle situations, e.g. involving functional dependencies and
type-family injectivity annotations, such as:
type family F a = r | r -> a
type instance F Int = Bool
[W] F beta ~R Bool
- - - - -
25edf516 by sheaf at 2026-01-28T06:56:38-05:00
Improve errors for unsolved representational equalities
This commit adds a new field of CtLoc, CtExplanations, which allows the
typechecker to leave some information about what it has done. For the moment,
it is only used to improve error messages for unsolved representational
equalities. The typechecker will now accumulate, when unifying at
representational role:
- out-of-scope newtype constructors,
- type constructors that have nominal role in a certain argument,
- over-saturated type constructors,
- AppTys, e.g. `c a ~R# c b`, to report that we must assume that 'c' has
nominal role in its parameters,
- data family applications that do not reduce, potentially preventing
newtype unwrapping.
Now, instead of having to re-construct the possible errors after the fact,
we simply consult the CtExplanations field.
Additionally, this commit modifies the typechecker error messages that
concern out-of-scope newtype constructors. The error message now depends
on whether we have an import suggestion to provide to the user:
- If we have an import suggestion for the newtype constructor,
the message will be of the form:
The data constructor MkN of the newtype N is out of scope
Suggested fix: add 'MkN' to the import list in the import of 'M'
- If we don't have any import suggestions, the message will be
of the form:
NB: The type 'N' is an opaque newtype, whose constructor is hidden
Fixes #15850, #20289, #20468, #23731, #25949, #26137
- - - - -
4d0e6da1 by Simon Peyton Jones at 2026-01-28T06:57:19-05:00
Fix two bugs in short-cut constraint solving
There are two main changes here:
* Use `isSolvedWC` rather than `isEmptyWC` in `tryShortCutSolver`
The residual constraint may have some fully-solved, but
still-there implications, and we don't want them to abort short
cut solving! That bug caused #26805.
* In the short-cut solver, we abandon the fully-solved residual
constraint; but we may thereby lose track of Givens that are
needed, and either report them as redundant or prune evidence
bindings that are in fact needed.
This bug stopped the `constraints` package from compiling;
see the trail in !15389.
The second bug led me to (another) significant refactoring
of the mechanism for tracking needed EvIds. See the new
Note [Tracking needed EvIds] in GHC.Tc.Solver.Solve
It's simpler and much less head-scratchy now.
Some particulars:
* An EvBindsVar now tracks NeededEvIds
* We deal with NeededEvIds for an implication only when it is
fully solved. Much simpler!
* `tryShortCutTcS` now takes a `TcM WantedConstraints` rather than
`TcM Bool`, so that is can plumb the needed EvIds correctly.
* Remove `ic_need` and `ic_need_implic` from Implication (hooray),
and add `ics_dm` and `ics_non_dm` to `IC_Solved`.
Pure refactor
* Shorten data constructor `CoercionHole` to `CH`, following
general practice in GHC.
* Rename `EvBindMap` to `EvBindsMap` for consistency
- - - - -
662480b7 by Cheng Shao at 2026-01-28T06:58:00-05:00
ci: use debian validate bindists instead of fedora release bindists in testing stage
This patch changes the `abi-test`, `hadrian-multi` and `perf` jobs in
the full-ci pipeline testing stage to use debian validate bindists
instead of fedora release bindists, to increase pipeline level
parallelism and allow full-ci pipelines to complete earlier. Closes #26818.
- - - - -
39581ec6 by Cheng Shao at 2026-01-28T06:58:40-05:00
ci: run perf test with -j$cores
This patch makes the perf ci job compile Cabal with -j$cores to speed
up the job.
- - - - -
9803ad87 by Simon Peyton Jones at 2026-01-29T00:09:20+00:00
Start at moving static forms straight to top level
Just for CI. Needs documentation.
Making static bindings have static constraint solving
- - - - -
d2ccb5b9 by Simon Peyton Jones at 2026-01-29T00:09:20+00:00
Wibble
- - - - -
67cce70a by Simon Peyton Jones at 2026-01-29T00:11:31+00:00
Wibbles tidying up
- - - - -
459e938c by Simon Peyton Jones at 2026-01-29T00:11:35+00:00
Print pat not pat' in pattern match errors
in ds_val_bind
- - - - -
636160c1 by Simon Peyton Jones at 2026-01-29T00:11:35+00:00
Zap unfolding in addImplicitBinds
to avoid inlining makeStatic into callers
- - - - -
d8646b3c by Simon Peyton Jones at 2026-01-29T00:11:35+00:00
Accept err changes
- - - - -
0273c7c2 by Simon Peyton Jones at 2026-01-29T00:11:35+00:00
Get closed types right
- - - - -
181fe64d by Simon Peyton Jones at 2026-01-29T00:11:35+00:00
Wibble
- - - - -
14051b2f by Simon Peyton Jones at 2026-01-29T00:11:35+00:00
Improve desugaring for pattern matching
...to avoid pattern match checking when we don't need it, and
to avoid emitting static pointers twice
- - - - -
6cda7e9a by Simon Peyton Jones at 2026-01-29T00:26:59+00:00
Wibble
- - - - -
291 changed files:
- .gitignore
- .gitlab-ci.yml
- .gitlab/ci.sh
- .gitlab/darwin/nix/sources.json
- .gitlab/darwin/toolchain.nix
- + .gitlab/issue_templates/get-verified.md
- .gitmodules
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/CmmToAsm/PPC/CodeGen.hs
- compiler/GHC/CmmToLlvm.hs
- compiler/GHC/CmmToLlvm/Base.hs
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/FamInstEnv.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/Pipeline.hs
- compiler/GHC/Core/Opt/SetLevels.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/Opt/SpecConstr.hs
- compiler/GHC/Core/Opt/WorkWrap.hs
- compiler/GHC/Core/Opt/WorkWrap/Utils.hs
- compiler/GHC/Core/Predicate.hs
- compiler/GHC/Core/Tidy.hs
- compiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Core/TyCo/Subst.hs
- compiler/GHC/Core/TyCo/Tidy.hs
- compiler/GHC/Core/TyCon/RecWalk.hs
- compiler/GHC/Core/Unfold.hs
- compiler/GHC/Core/Utils.hs
- compiler/GHC/CoreToStg/AddImplicitBinds.hs
- compiler/GHC/CoreToStg/Prep.hs
- compiler/GHC/Data/Maybe.hs
- compiler/GHC/Driver/CodeOutput.hs
- compiler/GHC/Driver/Config/Core/Lint.hs
- compiler/GHC/Driver/Pipeline/Execute.hs
- compiler/GHC/Hs/Binds.hs
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Instances.hs
- compiler/GHC/Hs/Syn/Type.hs
- compiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore.hs
- compiler/GHC/HsToCore/Docs.hs
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/GuardedRHSs.hs
- compiler/GHC/HsToCore/Match.hs
- compiler/GHC/HsToCore/Monad.hs
- compiler/GHC/HsToCore/Pmc.hs
- compiler/GHC/HsToCore/Pmc/Desugar.hs
- compiler/GHC/HsToCore/Pmc/Solver.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/HsToCore/Ticks.hs
- compiler/GHC/HsToCore/Types.hs
- compiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Iface/Tidy.hs
- compiler/GHC/Iface/Tidy/StaticPtrTable.hs
- compiler/GHC/Rename/Bind.hs
- compiler/GHC/Rename/Expr.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/Rename/Unbound.hs
- compiler/GHC/Stg/EnforceEpt.hs
- compiler/GHC/Stg/Lint.hs
- compiler/GHC/StgToCmm/Closure.hs
- compiler/GHC/StgToCmm/Expr.hs
- compiler/GHC/Tc/Deriv.hs
- compiler/GHC/Tc/Errors.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Gen/Bind.hs
- compiler/GHC/Tc/Gen/Default.hs
- compiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Gen/Head.hs
- compiler/GHC/Tc/Gen/Pat.hs
- compiler/GHC/Tc/Gen/Sig.hs
- compiler/GHC/Tc/Instance/Family.hs
- compiler/GHC/Tc/Module.hs
- compiler/GHC/Tc/Solver.hs
- compiler/GHC/Tc/Solver/Default.hs
- compiler/GHC/Tc/Solver/Dict.hs
- compiler/GHC/Tc/Solver/Equality.hs
- compiler/GHC/Tc/Solver/InertSet.hs
- compiler/GHC/Tc/Solver/Monad.hs
- compiler/GHC/Tc/Solver/Solve.hs
- compiler/GHC/Tc/TyCl/Instance.hs
- compiler/GHC/Tc/TyCl/Utils.hs
- compiler/GHC/Tc/Types.hs
- compiler/GHC/Tc/Types/BasicTypes.hs
- compiler/GHC/Tc/Types/Constraint.hs
- compiler/GHC/Tc/Types/CtLoc.hs
- compiler/GHC/Tc/Types/Evidence.hs
- compiler/GHC/Tc/Types/Origin.hs
- compiler/GHC/Tc/Utils/Env.hs
- compiler/GHC/Tc/Utils/Monad.hs
- compiler/GHC/Tc/Utils/TcMType.hs
- − compiler/GHC/Tc/Utils/TcMType.hs-boot
- compiler/GHC/Tc/Utils/Unify.hs
- compiler/GHC/Tc/Zonk/TcType.hs
- compiler/GHC/Tc/Zonk/Type.hs
- compiler/GHC/Types/Error/Codes.hs
- compiler/GHC/Types/Id.hs
- compiler/GHC/Types/Id/Info.hs
- compiler/GHC/Types/Id/Make.hs
- compiler/GHC/Types/RepType.hs
- compiler/GHC/Types/Var.hs
- compiler/GHC/Unit/State.hs
- compiler/GHC/Utils/Monad.hs
- compiler/GHC/Utils/Trace.hs
- compiler/ghc.cabal.in
- config.guess
- config.sub
- docs/users_guide/9.16.1-notes.rst
- docs/users_guide/exts/roles.rst
- docs/users_guide/index.rst
- docs/users_guide/runtime_control.rst
- hadrian/doc/flavours.md
- hadrian/doc/user-settings.md
- hadrian/hadrian.cabal
- hadrian/src/Context.hs
- hadrian/src/Flavour.hs
- hadrian/src/Hadrian/Utilities.hs
- hadrian/src/Rules/Docspec.hs
- hadrian/src/Rules/Documentation.hs
- hadrian/src/Rules/Lint.hs
- hadrian/src/Settings/Builders/Configure.hs
- hadrian/src/Settings/Builders/Ghc.hs
- hadrian/src/Settings/Builders/Make.hs
- hadrian/src/Settings/Builders/RunTest.hs
- hadrian/src/Settings/Builders/SplitSections.hs
- hadrian/src/Settings/Default.hs
- hadrian/src/Settings/Flavours/Benchmark.hs
- hadrian/src/Settings/Flavours/Development.hs
- hadrian/src/Settings/Flavours/GhcInGhci.hs
- hadrian/src/Settings/Flavours/Performance.hs
- hadrian/src/Settings/Flavours/Quick.hs
- hadrian/src/Settings/Flavours/QuickCross.hs
- hadrian/src/Settings/Flavours/Quickest.hs
- hadrian/src/Settings/Flavours/Validate.hs
- hadrian/src/Settings/Packages.hs
- libraries/base/base.cabal.in
- libraries/base/changelog.md
- libraries/base/src/Control/Concurrent.hs
- libraries/base/src/Data/Array/Byte.hs
- − libraries/base/src/GHC/JS/Prim/Internal/Build.hs
- libraries/base/src/GHC/Num.hs
- − libraries/base/src/GHC/Num/BigNat.hs
- − libraries/base/src/GHC/Num/Integer.hs
- − libraries/base/src/GHC/Num/Natural.hs
- libraries/base/src/System/CPUTime/Utils.hs
- + libraries/base/src/System/IO/OS.hs
- libraries/base/src/System/Timeout.hs
- libraries/base/tests/IO/all.T
- + libraries/base/tests/IO/osHandles001FileDescriptors.hs
- + libraries/base/tests/IO/osHandles001FileDescriptors.stdout
- + libraries/base/tests/IO/osHandles001WindowsHandles.hs
- + libraries/base/tests/IO/osHandles001WindowsHandles.stdout
- + libraries/base/tests/IO/osHandles002FileDescriptors.hs
- + libraries/base/tests/IO/osHandles002FileDescriptors.stderr
- + libraries/base/tests/IO/osHandles002FileDescriptors.stdin
- + libraries/base/tests/IO/osHandles002FileDescriptors.stdout
- + libraries/base/tests/IO/osHandles002WindowsHandles.hs
- + libraries/base/tests/IO/osHandles002WindowsHandles.stderr
- + libraries/base/tests/IO/osHandles002WindowsHandles.stdin
- + libraries/base/tests/IO/osHandles002WindowsHandles.stdout
- libraries/base/tests/T23454.stderr
- libraries/base/tests/perf/Makefile
- libraries/ghc-bignum/ghc-bignum.cabal
- libraries/ghc-compact/tests/all.T
- libraries/ghc-experimental/CHANGELOG.md
- libraries/ghc-experimental/ghc-experimental.cabal.in
- libraries/ghc-experimental/src/GHC/Exception/Backtrace/Experimental.hs
- libraries/ghc-experimental/src/GHC/TypeNats/Experimental.hs
- libraries/ghc-internal/ghc-internal.cabal.in
- libraries/ghc-internal/src/GHC/Internal/CString.hs
- libraries/ghc-internal/src/GHC/Internal/Classes.hs
- + libraries/ghc-internal/src/GHC/Internal/Classes/IP.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Data.hs
- libraries/ghc-internal/src/GHC/Internal/Err.hs
- libraries/ghc-internal/src/GHC/Internal/Exts.hs
- libraries/ghc-internal/src/GHC/Internal/Functor/ZipList.hs
- + libraries/ghc-internal/src/GHC/Internal/System/IO/OS.hs
- libraries/ghc-internal/tests/backtraces/all.T
- libraries/ghc-internal/tests/stack-annotation/all.T
- + libraries/ghc-internal/tests/stack-annotation/ann_frame005.hs
- + libraries/ghc-internal/tests/stack-annotation/ann_frame005.stdout
- libraries/ghci/GHCi/Server.hs
- libraries/haskeline
- llvm-targets
- rts/AllocArray.c
- rts/AllocArray.h
- rts/ClosureTable.c
- rts/Heap.c
- rts/PrimOps.cmm
- rts/RtsFlags.c
- rts/Threads.c
- rts/Trace.c
- rts/Weak.c
- rts/include/Cmm.h
- rts/include/rts/Flags.h
- rts/include/stg/Ticky.h
- rts/rts.cabal
- rts/sm/Evac.c
- rts/sm/Evac_thr.c → rts/sm/Evac_par.c
- rts/sm/Scav_thr.c → rts/sm/Scav_par.c
- rts/sm/Storage.c
- − rts/win32/libHSffi.def
- − rts/win32/libHSghc-internal.def
- − rts/win32/libHSghc-prim.def
- testsuite/driver/runtests.py
- testsuite/driver/testglobals.py
- testsuite/driver/testlib.py
- testsuite/driver/testutil.py
- testsuite/tests/codeGen/should_run/CgStaticPointers.hs
- + testsuite/tests/default/T25825.hs
- testsuite/tests/default/all.T
- testsuite/tests/deriving/should_fail/T1496.stderr
- testsuite/tests/deriving/should_fail/T4846.stderr
- testsuite/tests/deriving/should_fail/T5498.stderr
- testsuite/tests/deriving/should_fail/T6147.stderr
- testsuite/tests/deriving/should_fail/T7148.stderr
- testsuite/tests/deriving/should_fail/T7148a.stderr
- testsuite/tests/deriving/should_fail/T8984.stderr
- testsuite/tests/deriving/should_fail/deriving-via-fail.stderr
- testsuite/tests/deriving/should_fail/deriving-via-fail4.stderr
- testsuite/tests/deriving/should_fail/deriving-via-fail5.stderr
- testsuite/tests/driver/T16318/Makefile
- testsuite/tests/driver/T18125/Makefile
- testsuite/tests/gadt/CasePrune.stderr
- testsuite/tests/ghci.debugger/scripts/T8487.stdout
- testsuite/tests/ghci.debugger/scripts/break011.stdout
- testsuite/tests/ghci.debugger/scripts/break017.stdout
- testsuite/tests/ghci.debugger/scripts/break025.stdout
- testsuite/tests/indexed-types/should_fail/T9580.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/interface-stability/ghc-experimental-exports.stdout
- testsuite/tests/interface-stability/ghc-experimental-exports.stdout-mingw32
- testsuite/tests/interface-stability/ghc-prim-exports.stdout
- testsuite/tests/interface-stability/ghc-prim-exports.stdout-mingw32
- testsuite/tests/linear/should_fail/LinearRole.stderr
- testsuite/tests/perf/should_run/all.T
- testsuite/tests/rename/should_fail/RnStaticPointersFail01.stderr
- testsuite/tests/rename/should_fail/RnStaticPointersFail03.stderr
- testsuite/tests/roles/should_fail/RolesIArray.stderr
- testsuite/tests/rts/Makefile
- testsuite/tests/rts/all.T
- testsuite/tests/rts/ipe/all.T
- testsuite/tests/simplCore/should_compile/T18013.stderr
- + testsuite/tests/simplCore/should_compile/T26722.hs
- + testsuite/tests/simplCore/should_compile/T26722.stderr
- + testsuite/tests/simplCore/should_compile/T26805.hs
- + testsuite/tests/simplCore/should_compile/T26805.stderr
- testsuite/tests/simplCore/should_compile/all.T
- testsuite/tests/th/TH_implicitParams.stdout
- + testsuite/tests/typecheck/should_compile/T26737.hs
- + testsuite/tests/typecheck/should_compile/T26746.hs
- + testsuite/tests/typecheck/should_compile/T26805a.hs
- testsuite/tests/typecheck/should_compile/all.T
- testsuite/tests/typecheck/should_fail/T10285.stderr
- testsuite/tests/typecheck/should_fail/T10534.stderr
- testsuite/tests/typecheck/should_fail/T10715b.stderr
- testsuite/tests/typecheck/should_fail/T11347.stderr
- testsuite/tests/typecheck/should_fail/T15801.stderr
- + testsuite/tests/typecheck/should_fail/T15850.hs
- + testsuite/tests/typecheck/should_fail/T15850.stderr
- + testsuite/tests/typecheck/should_fail/T15850_Lib.hs
- + testsuite/tests/typecheck/should_fail/T20289.hs
- + testsuite/tests/typecheck/should_fail/T20289.stderr
- + testsuite/tests/typecheck/should_fail/T20289_A.hs
- testsuite/tests/typecheck/should_fail/T22645.stderr
- testsuite/tests/typecheck/should_fail/T22924a.stderr
- testsuite/tests/typecheck/should_fail/T22924b.stderr
- + testsuite/tests/typecheck/should_fail/T23731.hs
- + testsuite/tests/typecheck/should_fail/T23731.stderr
- + testsuite/tests/typecheck/should_fail/T23731b.hs
- + testsuite/tests/typecheck/should_fail/T23731b.stderr
- + testsuite/tests/typecheck/should_fail/T23731b_aux.hs
- + testsuite/tests/typecheck/should_fail/T25679.hs
- + testsuite/tests/typecheck/should_fail/T25679.stderr
- + testsuite/tests/typecheck/should_fail/T25949.hs
- + testsuite/tests/typecheck/should_fail/T25949.stderr
- + testsuite/tests/typecheck/should_fail/T25949_aux.hs
- + testsuite/tests/typecheck/should_fail/T26137.hs
- + testsuite/tests/typecheck/should_fail/T26137.stderr
- testsuite/tests/typecheck/should_fail/TcCoercibleFail.hs
- testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr
- testsuite/tests/typecheck/should_fail/TcCoercibleFail3.stderr
- testsuite/tests/typecheck/should_fail/all.T
- testsuite/tests/warnings/should_fail/CaretDiagnostics1.stderr
- utils/ghc-toolchain/exe/Main.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e3b527395cbcf0247824235569edc0…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e3b527395cbcf0247824235569edc0…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/T24464] Improve desugaring for pattern matching
by Simon Peyton Jones (@simonpj) 29 Jan '26
by Simon Peyton Jones (@simonpj) 29 Jan '26
29 Jan '26
Simon Peyton Jones pushed to branch wip/T24464 at Glasgow Haskell Compiler / GHC
Commits:
e3b52739 by Simon Peyton Jones at 2026-01-29T00:08:38+00:00
Improve desugaring for pattern matching
...to avoid pattern match checking when we don't need it, and
to avoid emitting static pointers twice
- - - - -
8 changed files:
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/GuardedRHSs.hs
- compiler/GHC/HsToCore/Match.hs
- compiler/GHC/HsToCore/Monad.hs
- compiler/GHC/HsToCore/Pmc.hs
- compiler/GHC/HsToCore/Types.hs
- compiler/GHC/Tc/Gen/Bind.hs
- compiler/GHC/Tc/Utils/Env.hs
Changes:
=====================================
compiler/GHC/HsToCore/Expr.hs
=====================================
@@ -29,6 +29,7 @@ import GHC.HsToCore.Utils
import GHC.HsToCore.Arrows
import GHC.HsToCore.Monad
import GHC.HsToCore.Pmc
+import GHC.HsToCore.Types( LdiNablas(..) )
import GHC.HsToCore.Pmc.Utils
import GHC.HsToCore.Errors.Types
import GHC.HsToCore.Quote
@@ -505,7 +506,12 @@ dsExpr (HsStatic (static_ptr_ty, from_static_fun) expr@(L loc _))
; static_id <- newStaticId (mkSpecForAllTys static_fvs static_ptr_ty)
- ; emitStaticBinds [(static_id, static_rhs)]
+ -- Emit the static bindings to top level, but NOT when we are in
+ -- the auxiliary desugaring for the pattern-match checking
+ ; ldi_nablas <- getPmNablas
+ ; case ldi_nablas of
+ NoPmc -> return ()
+ Ldi {} -> emitStaticBinds [(static_id, static_rhs)]
; return (App from_static_ds (mkVarApps (Var static_id) static_fvs)) }
=====================================
compiler/GHC/HsToCore/GuardedRHSs.hs
=====================================
@@ -22,7 +22,7 @@ import GHC.Core.Utils (bindNonRec)
import GHC.HsToCore.Monad
import GHC.HsToCore.Utils
-import GHC.HsToCore.Pmc.Types ( Nablas )
+import GHC.HsToCore.Types
import GHC.Core.Type ( Type )
import GHC.Types.SrcLoc
import GHC.Utils.Outputable
@@ -44,7 +44,7 @@ producing an expression with a runtime error in the corner case if
necessary. The type argument gives the type of the @ei@.
-}
-dsGuarded :: GRHSs GhcTc (LHsExpr GhcTc) -> Type -> NonEmpty Nablas -> DsM CoreExpr
+dsGuarded :: GRHSs GhcTc (LHsExpr GhcTc) -> Type -> NonEmpty LdiNablas -> DsM CoreExpr
dsGuarded grhss rhs_ty rhss_nablas = do
match_result <- dsGRHSs PatBindRhs grhss rhs_ty rhss_nablas
error_expr <- mkErrorAppDs nON_EXHAUSTIVE_GUARDS_ERROR_ID rhs_ty
@@ -56,7 +56,7 @@ dsGuarded grhss rhs_ty rhss_nablas = do
dsGRHSs :: HsMatchContextRn
-> GRHSs GhcTc (LHsExpr GhcTc) -- ^ Guarded RHSs
-> Type -- ^ Type of RHS
- -> NonEmpty Nablas -- ^ Refined pattern match checking
+ -> NonEmpty LdiNablas -- ^ Refined pattern match checking
-- models, one for the pattern part and
-- one for each GRHS.
-> DsM (MatchResult CoreExpr)
@@ -73,11 +73,11 @@ dsGRHSs hs_ctx (GRHSs _ grhss binds) rhs_ty rhss_nablas
-- NB: nested dsLet inside matchResult
; return match_result2 }
-dsGRHS :: HsMatchContextRn -> Type -> Nablas -> LGRHS GhcTc (LHsExpr GhcTc)
+dsGRHS :: HsMatchContextRn -> Type -> LdiNablas -> LGRHS GhcTc (LHsExpr GhcTc)
-> DsM (MatchResult CoreExpr)
dsGRHS hs_ctx rhs_ty rhs_nablas (L _ (GRHS _ guards rhs))
= updPmNablas rhs_nablas $
- matchGuards (map unLoc guards) hs_ctx rhs rhs_ty
+ matchGuards (map unLoc guards) hs_ctx rhs rhs_ty
{-
************************************************************************
=====================================
compiler/GHC/HsToCore/Match.hs
=====================================
@@ -39,7 +39,7 @@ import GHC.Tc.Types.Evidence
import GHC.Tc.Utils.Monad
import GHC.HsToCore.Pmc
import GHC.HsToCore.Pmc.Utils
-import GHC.HsToCore.Pmc.Types ( Nablas )
+import GHC.HsToCore.Types ( LdiNablas )
import GHC.HsToCore.Monad
import GHC.HsToCore.Binds
import GHC.HsToCore.GuardedRHSs
@@ -833,7 +833,9 @@ matchWrapper ctxt scrs (MG { mg_alts = L _ matches
; return (new_vars, result_expr) }
where
-- Called once per equation in the match, or alternative in the case
- mk_eqn_info :: LMatch GhcTc (LHsExpr GhcTc) -> (Nablas, NonEmpty Nablas) -> DsM EquationInfo
+ mk_eqn_info :: LMatch GhcTc (LHsExpr GhcTc)
+ -> (LdiNablas, NonEmpty LdiNablas)
+ -> DsM EquationInfo
mk_eqn_info (L _ (Match { m_pats = L _ pats, m_grhss = grhss })) (pat_nablas, rhss_nablas)
= do { dflags <- getDynFlags
; let upats = map (decideBangHood dflags) pats
@@ -850,13 +852,6 @@ matchWrapper ctxt scrs (MG { mg_alts = L _ matches
then id
else discardWarningsDs
- initNablasMatches :: Nablas -> [LMatch GhcTc b] -> [(Nablas, NonEmpty Nablas)]
- initNablasMatches ldi_nablas ms
- = map (\(L _ m) -> (ldi_nablas, initNablasGRHSs ldi_nablas (m_grhss m))) ms
-
- initNablasGRHSs :: Nablas -> GRHSs GhcTc b -> NonEmpty Nablas
- initNablasGRHSs ldi_nablas m = ldi_nablas <$ grhssGRHSs m
-
{- Note [Long-distance information in matchWrapper]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The pattern match checking in matchWrapper is done conditionally, depending
@@ -985,7 +980,7 @@ matchSinglePatVar var mb_scrut ctx pat ty match_result
; match [var] ty [eqn_info] }
-updPmNablasMatchResult :: Nablas -> MatchResult r -> MatchResult r
+updPmNablasMatchResult :: LdiNablas -> MatchResult r -> MatchResult r
updPmNablasMatchResult nablas = \case
MR_Infallible body_fn -> MR_Infallible $
updPmNablas nablas body_fn
=====================================
compiler/GHC/HsToCore/Monad.hs
=====================================
@@ -65,7 +65,7 @@ import GHC.Hs
import GHC.HsToCore.Types
import GHC.HsToCore.Errors.Types
-import GHC.HsToCore.Pmc.Solver.Types (Nablas, initNablas)
+import GHC.HsToCore.Pmc.Solver.Types (initNablas)
import GHC.Core.FamInstEnv
import GHC.Core
@@ -416,7 +416,7 @@ mkDsEnvs unit_env mod rdr_env type_env fam_inst_env ptc msg_var cc_st_var
}
lcl_env = DsLclEnv { dsl_meta = emptyNameEnv
, dsl_loc = real_span
- , dsl_nablas = initNablas
+ , dsl_nablas = Ldi initNablas
, dsl_unspecables = Just emptyVarSet
}
in (gbl_env, lcl_env)
@@ -479,12 +479,12 @@ getGhcModeDs :: DsM GhcMode
getGhcModeDs = getDynFlags >>= return . ghcMode
-- | Get the current pattern match oracle state. See 'dsl_nablas'.
-getPmNablas :: DsM Nablas
+getPmNablas :: DsM LdiNablas
getPmNablas = do { env <- getLclEnv; return (dsl_nablas env) }
-- | Set the pattern match oracle state within the scope of the given action.
-- See 'dsl_nablas'.
-updPmNablas :: Nablas -> DsM a -> DsM a
+updPmNablas :: LdiNablas -> DsM a -> DsM a
updPmNablas nablas = updLclEnv (\env -> env { dsl_nablas = nablas })
addUnspecables :: [EvVar] -> DsM a -> DsM a
=====================================
compiler/GHC/HsToCore/Pmc.hs
=====================================
@@ -30,6 +30,7 @@
module GHC.HsToCore.Pmc (
-- Checking and printing
pmcPatBind, pmcMatches, pmcGRHSs, pmcRecSel,
+ initNablasMatches,
isMatchContextPmChecked, isMatchContextPmChecked_SinglePat,
-- See Note [Long-distance information]
@@ -45,6 +46,7 @@ import GHC.HsToCore.Pmc.Utils
import GHC.HsToCore.Pmc.Desugar
import GHC.HsToCore.Pmc.Check
import GHC.HsToCore.Pmc.Solver
+import GHC.HsToCore.Types
import GHC.Types.Basic (Origin(..), isDoExpansionGenerated)
import GHC.Core
import GHC.Driver.DynFlags
@@ -77,26 +79,35 @@ import GHC.Tc.Utils.Monad
-- capturing long-distance information, or the trivially habitable 'Nablas' if
-- the former is uninhabited.
-- See Note [Recovering from unsatisfiable pattern-matching constraints].
-getLdiNablas :: DsM Nablas
+getLdiNablas :: DsM LdiNablas
getLdiNablas = do
nablas <- getPmNablas
- isInhabited nablas >>= \case
- True -> pure nablas
- False -> pure initNablas
+ case nablas of
+ NoPmc -> pure NoPmc
+ Ldi nablas -> isInhabited nablas >>= \case
+ True -> pure (Ldi nablas)
+ False -> pure (Ldi initNablas)
-- | We need to call the Hs desugarer to get the Core of a let-binding or where
-- clause. We don't want to run the coverage checker when doing so! Efficiency
-- is one concern, but also a lack of properly set up long-distance information
-- might trigger warnings that we normally wouldn't emit.
-noCheckDs :: DsM a -> DsM a
-noCheckDs = updTopFlags (\dflags -> foldl' wopt_unset dflags allPmCheckWarnings)
+dontDoPmc :: DsM a -> DsM a
+dontDoPmc thing_inside = updPmNablas NoPmc thing_inside
+
+whenDoingPmc :: a -> (Nablas -> DsM a) -> DsM a
+whenDoingPmc no_pmc thing_inside
+ = do { ldi_nablas <- getPmNablas
+ ; case ldi_nablas of
+ NoPmc -> return no_pmc
+ Ldi nablas -> thing_inside nablas }
-- | Check a pattern binding (let, where) for exhaustiveness.
-pmcPatBind :: DsMatchContext -> Id -> Pat GhcTc -> DsM Nablas
+pmcPatBind :: DsMatchContext -> Id -> Pat GhcTc -> DsM LdiNablas
pmcPatBind ctxt@(DsMatchContext match_ctxt loc) var p
- = mb_discard_warnings $ do
- !missing <- getLdiNablas
- pat_bind <- noCheckDs $ desugarPatBind loc var p
+ = whenDoingPmc NoPmc $ \ !missing ->
+ mb_discard_warnings $ do
+ pat_bind <- dontDoPmc $ desugarPatBind loc var p
tracePm "pmcPatBind {" (vcat [ppr ctxt, ppr var, ppr p, ppr pat_bind, ppr missing])
result <- unCA (checkPatBind pat_bind) missing
let ldi = ldiGRHS $ ( \ pb -> case pb of PmPatBind grhs -> grhs) $ cr_ret result
@@ -124,21 +135,21 @@ pmcPatBind ctxt@(DsMatchContext match_ctxt loc) var p
pmcGRHSs
:: HsMatchContextRn -- ^ Match context, for warning messages
-> GRHSs GhcTc (LHsExpr GhcTc) -- ^ The GRHSs to check
- -> DsM (NonEmpty Nablas) -- ^ Covered 'Nablas' for each RHS, for long
- -- distance info
-pmcGRHSs hs_ctxt guards@(GRHSs _ grhss _) = do
- let combined_loc = foldl1 combineSrcSpans (NE.map getLocA grhss)
- ctxt = DsMatchContext hs_ctxt combined_loc
- !missing <- getLdiNablas
- matches <- noCheckDs $ desugarGRHSs combined_loc empty guards
- tracePm "pmcGRHSs" (hang (vcat [ppr ctxt
- , text "Guards:"])
- 2
- (pprGRHSs hs_ctxt guards $$ ppr missing))
- result <- unCA (checkGRHSs matches) missing
- tracePm "}: " (ppr (cr_uncov result))
- formatReportWarnings ReportGRHSs ctxt [] result
- return (ldiGRHSs (cr_ret result))
+ -> DsM (NonEmpty LdiNablas) -- ^ Covered 'Nablas' for each RHS,
+ -- for long distance info
+pmcGRHSs hs_ctxt guards@(GRHSs _ grhss _) =
+ whenDoingPmc (NE.map (const NoPmc) grhss) $ \ !missing -> do
+ let combined_loc = foldl1 combineSrcSpans (NE.map getLocA grhss)
+ ctxt = DsMatchContext hs_ctxt combined_loc
+ matches <- dontDoPmc $ desugarGRHSs combined_loc empty guards
+ tracePm "pmcGRHSs" (hang (vcat [ppr ctxt
+ , text "Guards:"])
+ 2
+ (pprGRHSs hs_ctxt guards $$ ppr missing))
+ result <- unCA (checkGRHSs matches) missing
+ tracePm "}: " (ppr (cr_uncov result))
+ formatReportWarnings ReportGRHSs ctxt [] result
+ return (ldiGRHSs (cr_ret result))
-- | Check a list of syntactic 'Match'es (part of case, functions, etc.), each
-- with a 'Pat' and one or more 'GRHSs':
@@ -160,37 +171,44 @@ pmcMatches
-> DsMatchContext -- ^ Match context, for warnings messages
-> [Id] -- ^ Match variables, i.e. x and y above
-> [LMatch GhcTc (LHsExpr GhcTc)] -- ^ List of matches
- -> DsM [(Nablas, NonEmpty Nablas)] -- ^ One covered 'Nablas' per Match and
- -- GRHS, for long distance info.
-pmcMatches origin ctxt vars matches = {-# SCC "pmcMatches" #-} do
- -- We have to force @missing@ before printing out the trace message,
- -- otherwise we get interleaved output from the solver. This function
- -- should be strict in @missing@ anyway!
- !missing <- getLdiNablas
- tracePm "pmcMatches {" $
- hang (vcat [ppr origin, ppr ctxt, ppr vars, text "Matches:"])
- 2
- ((ppr matches) $$ (text "missing:" <+> ppr missing))
- case NE.nonEmpty matches of
- Nothing -> do
- -- This must be an -XEmptyCase. See Note [Checking EmptyCase]
- let var = only vars
- empty_case <- noCheckDs $ desugarEmptyCase var
- result <- unCA (checkEmptyCase empty_case) missing
- tracePm "}: " (ppr (cr_uncov result))
- formatReportWarnings ReportEmptyCase ctxt vars result
- return []
- Just matches -> do
- matches <- {-# SCC "desugarMatches" #-}
- noCheckDs $ desugarMatches vars matches
- tracePm "desugared matches" (ppr matches)
- result <- {-# SCC "checkMatchGroup" #-}
- unCA (checkMatchGroup matches) missing
- tracePm "}: " (ppr (cr_uncov result))
- unless (isDoExpansionGenerated origin) -- Do expansion generated code shouldn't emit overlapping warnings
- ({-# SCC "formatReportWarnings" #-}
- formatReportWarnings ReportMatchGroup ctxt vars result)
- return (NE.toList (ldiMatchGroup (cr_ret result)))
+ -> DsM [(LdiNablas, NonEmpty LdiNablas)] -- ^ One covered 'Nablas' per Match and
+ -- GRHS, for long distance info.
+pmcMatches origin ctxt vars matches = {-# SCC "pmcMatches" #-}
+ whenDoingPmc (initNablasMatches NoPmc matches) $ \ !missing -> do
+ -- We have to force @missing@ before printing out the trace message,
+ -- otherwise we get interleaved output from the solver. This function
+ -- should be strict in @missing@ anyway!
+ tracePm "pmcMatches {" $
+ hang (vcat [ppr origin, ppr ctxt, ppr vars, text "Matches:"])
+ 2
+ ((ppr matches) $$ (text "missing:" <+> ppr missing))
+ case NE.nonEmpty matches of
+ Nothing -> do
+ -- This must be an -XEmptyCase. See Note [Checking EmptyCase]
+ let var = only vars
+ empty_case <- dontDoPmc $ desugarEmptyCase var
+ result <- unCA (checkEmptyCase empty_case) missing
+ tracePm "}: " (ppr (cr_uncov result))
+ formatReportWarnings ReportEmptyCase ctxt vars result
+ return []
+ Just matches -> do
+ matches <- {-# SCC "desugarMatches" #-}
+ dontDoPmc $ desugarMatches vars matches
+ tracePm "desugared matches" (ppr matches)
+ result <- {-# SCC "checkMatchGroup" #-}
+ unCA (checkMatchGroup matches) missing
+ tracePm "}: " (ppr (cr_uncov result))
+ unless (isDoExpansionGenerated origin) -- Do expansion generated code shouldn't emit overlapping warnings
+ ({-# SCC "formatReportWarnings" #-}
+ formatReportWarnings ReportMatchGroup ctxt vars result)
+ return (NE.toList (ldiMatchGroup (cr_ret result)))
+
+initNablasMatches :: LdiNablas -> [LMatch GhcTc b] -> [(LdiNablas, NonEmpty LdiNablas)]
+initNablasMatches ldi_nablas ms
+ = map (\(L _ m) -> (ldi_nablas, initNablasGRHSs ldi_nablas (m_grhss m))) ms
+ where
+ initNablasGRHSs :: LdiNablas -> GRHSs GhcTc b -> NonEmpty LdiNablas
+ initNablasGRHSs ldi_nablas m = NE.map (const ldi_nablas) (grhssGRHSs m)
{-
Note [Detecting incomplete record selectors]
@@ -361,9 +379,8 @@ pmcRecSel sel_id arg
| RecSelId{ sel_cons = rec_sel_info } <- idDetails sel_id
, RSI { rsi_def = cons_w_field, rsi_undef = cons_wo_field } <- rec_sel_info
, not (null cons_wo_field)
- = do { !missing <- getLdiNablas
-
- ; tracePm "pmcRecSel {" (ppr sel_id)
+ = whenDoingPmc () $ \ !missing ->
+ do { tracePm "pmcRecSel {" (ppr sel_id)
; CheckResult{ cr_ret = PmRecSel{ pr_arg_var = arg_id }, cr_uncov = uncov_nablas }
<- unCA (checkRecSel (PmRecSel () arg cons_w_field)) missing
; tracePm "}: " $ ppr uncov_nablas
@@ -415,18 +432,18 @@ discardWarningsDs.
-- * Collecting long-distance information
--
-ldiMatchGroup :: PmMatchGroup Post -> NonEmpty (Nablas, NonEmpty Nablas)
+ldiMatchGroup :: PmMatchGroup Post -> NonEmpty (LdiNablas, NonEmpty LdiNablas)
ldiMatchGroup (PmMatchGroup matches) = ldiMatch <$> matches
-ldiMatch :: PmMatch Post -> (Nablas, NonEmpty Nablas)
+ldiMatch :: PmMatch Post -> (LdiNablas, NonEmpty LdiNablas)
ldiMatch (PmMatch { pm_pats = red, pm_grhss = grhss }) =
- (rs_cov red, ldiGRHSs grhss)
+ (Ldi (rs_cov red), ldiGRHSs grhss)
-ldiGRHSs :: PmGRHSs Post -> NonEmpty Nablas
+ldiGRHSs :: PmGRHSs Post -> NonEmpty LdiNablas
ldiGRHSs (PmGRHSs { pgs_grhss = grhss }) = ldiGRHS <$> grhss
-ldiGRHS :: PmGRHS Post -> Nablas
-ldiGRHS (PmGRHS { pg_grds = red }) = rs_cov red
+ldiGRHS :: PmGRHS Post -> LdiNablas
+ldiGRHS (PmGRHS { pg_grds = red }) = Ldi (rs_cov red)
--
-- * Collecting redundancy information
@@ -620,9 +637,11 @@ getNFirstUncovered mode vars n (MkNablas nablas) = go n (bagToList nablas)
-- with 'unsafeInterleaveM' in order not to do unnecessary work.
locallyExtendPmNablas :: DsM a -> (Nablas -> DsM Nablas) -> DsM a
locallyExtendPmNablas k ext = do
- nablas <- getLdiNablas
- nablas' <- unsafeInterleaveM $ ext nablas
- updPmNablas nablas' k
+ ldi_nablas <- getLdiNablas
+ case ldi_nablas of
+ NoPmc -> k -- No nablas to extend, easy!
+ Ldi nablas -> do { nablas' <- unsafeInterleaveM $ ext nablas
+ ; updPmNablas (Ldi nablas') k }
-- | Add in-scope type constraints if the coverage checker might run and then
-- run the given action.
@@ -670,18 +689,40 @@ Consider
Humans can make the "long-distance connection" between the outer pattern match
and the nested case pattern match to see that the inner pattern match is
-exhaustive: @c@ can't be @R@ anymore because it was matched in the first clause
-of @f@.
-
-To achieve similar reasoning in the coverage checker, we keep track of the set
-of values that can reach a particular program point (often loosely referred to
-as "Covered set") in 'GHC.HsToCore.Monad.dsl_nablas'.
-We fill that set with Covered Nablas returned by the exported checking
-functions, which the call sites put into place with
-'GHC.HsToCore.Monad.updPmNablas'.
-Call sites also extend this set with facts from type-constraint dictionaries,
-case scrutinees, etc. with the exported functions 'addTyCs', 'addCoreScrutTmCs'
-and 'addHsScrutTmCs'.
+exhaustive: `c` can't be `R` anymore because it was matched in the first clause
+of `f`.
+
+To achieve similar reasoning in the coverage checker:
+
+* We keep track of the set of values that can reach a particular program point
+ (often loosely refer red to as "Covered set") in 'GHC.HsToCore.Monad.dsl_nablas
+ :: LdiNablas'.
+
+* We fill that set with Covered Nablas returned by the exported checking functions,
+ which the call sites put into place with 'GHC.HsToCore.Monad.updPmNablas'.
+
+* Call sites also extend this set with facts from type-constraint dictionaries,
+ case scrutinees, etc. with the exported functions 'addTyCs', 'addCoreScrutTmCs'
+ and 'addHsScrutTmCs'.
+
+Wrinkles:
+
+(LDI1) During patterm-match checking, we need to make an auxiliary call the Hs
+ desugarer to get the Core of a let-binding or where-clause. We don't want to run
+ the coverage checker when doing so! Efficiency is one concern, but also a lack of
+ properly set up long-distance information might trigger warnings that we normally
+ wouldn't emit.
+
+ So `dsl_nablas :: LdiNablas` where
+ data LdiNablas = NoPmc | Ldi Nablas
+
+ If dsl_nablas = NoPmc, that means we are in one of these auxiliary calls; so
+ we want to do no pattern-match checking whatsoever. We won't need to carry
+ any long-distance info around; we are simply degsugaring to Core.
+
+ If dsl_nablas = Ldi nablas, then we do want to do pattern-match checking,
+ and the long-distance context is given by `nablas`
+
Note [Recovering from unsatisfiable pattern-matching constraints]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
=====================================
compiler/GHC/HsToCore/Types.hs
=====================================
@@ -7,7 +7,7 @@
-- | Various types used during desugaring.
module GHC.HsToCore.Types (
- DsM, DsLclEnv(..), DsGblEnv(..),
+ DsM, DsLclEnv(..), DsGblEnv(..), LdiNablas(..),
DsMetaEnv, DsMetaVal(..), CompleteMatches
) where
@@ -85,13 +85,23 @@ data DsGblEnv
instance ContainsModule DsGblEnv where
extractModule = ds_mod
+data LdiNablas
+ = NoPmc -- Do desugaring only, no pattern-match checking
+ -- See (LDI1) in Note [Long-distance information]
+ | Ldi Nablas -- Do pattern match checking; here are "reaching values" Nablas
+
+instance Outputable LdiNablas where
+ ppr NoPmc = text "NoPmc"
+ ppr (Ldi ns) = text "Ldi" <> braces (ppr ns)
+
-- | Local state of the desugarer, extended as we lexically descend
data DsLclEnv
= DsLclEnv
{ dsl_meta :: DsMetaEnv -- ^ Template Haskell bindings
, dsl_loc :: RealSrcSpan -- ^ To put in pattern-matching error msgs
- , dsl_nablas :: Nablas
- -- ^ See Note [Long-distance information] in "GHC.HsToCore.Pmc".
+
+ , dsl_nablas :: LdiNablas
+ -- ^ See Note [Long-distance information] in "GHC.HsToCore.Pmc", esp (LDI1)
-- The set of reaching values Nablas is augmented as we walk inwards, refined
-- through each pattern match in turn
=====================================
compiler/GHC/Tc/Gen/Bind.hs
=====================================
@@ -1874,9 +1874,9 @@ isClosedBndrGroup type_env binds
| otherwise
= True -- The free-var set for a top level binding mentions
- -- * imported things so that we can report unused imports
- -- * class method etc from the current module
- -- * the Ids from the current Rec group
+ -- - imported things so that we can report unused imports
+ -- - class method etc from the current module
+ -- - the Ids from the current Rec group
-- None of these will be in the type envt
lHsBindFreeVars :: LHsBind GhcRn -> NameSet
=====================================
compiler/GHC/Tc/Utils/Env.hs
=====================================
@@ -117,7 +117,7 @@ import GHC.Utils.Misc ( HasDebugCallStack )
import GHC.Data.FastString
import GHC.Data.List.SetOps
-import GHC.Data.Maybe( MaybeErr(..), maybeToList, fromMaybe, isNothing )
+import GHC.Data.Maybe( MaybeErr(..), maybeToList, fromMaybe )
import GHC.Types.SrcLoc
import GHC.Types.Basic hiding( SuccessFlag(..) )
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e3b527395cbcf0247824235569edc0e…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e3b527395cbcf0247824235569edc0e…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
Bodigrim pushed new branch wip/text-2.1.4 at Glasgow Haskell Compiler / GHC
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/text-2.1.4
You're receiving this email because of your account on gitlab.haskell.org.
1
0
28 Jan '26
Teo Camarasu pushed to branch wip/T26834 at Glasgow Haskell Compiler / GHC
Commits:
c7cab142 by Teo Camarasu at 2026-01-28T19:02:39+00:00
Split out GHC.Internal.Data.Ord.Down
- - - - -
10 changed files:
- libraries/ghc-internal/ghc-internal.cabal.in
- libraries/ghc-internal/src/GHC/Internal/Control/Monad/Fix.hs
- libraries/ghc-internal/src/GHC/Internal/Control/Monad/Zip.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Data.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Foldable.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Ord.hs
- + libraries/ghc-internal/src/GHC/Internal/Data/Ord/Down.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Traversable.hs
- libraries/ghc-internal/src/GHC/Internal/Exts.hs
- libraries/ghc-internal/src/GHC/Internal/Generics.hs
Changes:
=====================================
libraries/ghc-internal/ghc-internal.cabal.in
=====================================
@@ -160,6 +160,7 @@ Library
GHC.Internal.Data.NonEmpty
GHC.Internal.Data.OldList
GHC.Internal.Data.Ord
+ GHC.Internal.Data.Ord.Down
GHC.Internal.Data.Proxy
GHC.Internal.Data.Semigroup.Internal
GHC.Internal.Data.STRef
@@ -576,4 +577,4 @@ Library
ghc-options: -this-unit-id ghc-internal
-- Make sure we don't accidentally regress into anti-patterns
- ghc-options: -Wcompat -Wnoncanonical-monad-instances
+ ghc-options: -Wcompat -Wnoncanonical-monad-instances -Werror=unused-imports
=====================================
libraries/ghc-internal/src/GHC/Internal/Control/Monad/Fix.hs
=====================================
@@ -33,7 +33,6 @@ import GHC.Internal.Data.Maybe
import GHC.Internal.Data.Monoid ( Monoid, Dual(..), Sum(..), Product(..)
, First(..), Last(..), Alt(..), Ap(..) )
import GHC.Internal.Data.NonEmpty ( NonEmpty(..) )
-import GHC.Internal.Data.Ord ( Down(..) )
import GHC.Internal.Data.Tuple ( Solo(..), snd )
import GHC.Internal.Base ( Monad, errorWithoutStackTrace, (.) )
import GHC.Internal.Generics
@@ -167,13 +166,6 @@ instance (MonadFix f, MonadFix g) => MonadFix (f :*: g) where
fstP (a :*: _) = a
sndP (_ :*: b) = b
--- Instances for Data.Ord
-
--- | @since base-4.12.0.0
-instance MonadFix Down where
- mfix f = Down (fix (getDown . f))
-
-
-- | @since base-4.8.0.0
instance MonadFix Identity where
mfix f = Identity (fix (runIdentity . f))
=====================================
libraries/ghc-internal/src/GHC/Internal/Control/Monad/Zip.hs
=====================================
@@ -23,7 +23,6 @@ import GHC.Internal.Data.Functor.Identity
import qualified GHC.Internal.Data.Functor
import GHC.Internal.Data.Monoid
import GHC.Internal.Data.NonEmpty ( NonEmpty(..) )
-import GHC.Internal.Data.Ord ( Down(..) )
import GHC.Internal.Data.Proxy
--import qualified Data.List.NonEmpty as NE
import GHC.Internal.Generics
@@ -136,9 +135,3 @@ instance MonadZip f => MonadZip (M1 i c f) where
-- | @since 4.9.0.0
instance (MonadZip f, MonadZip g) => MonadZip (f :*: g) where
mzipWith f (x1 :*: y1) (x2 :*: y2) = mzipWith f x1 x2 :*: mzipWith f y1 y2
-
--- instances for GHC.Internal.Data.Ord
-
--- | @since 4.12.0.0
-instance MonadZip Down where
- mzipWith = liftM2
=====================================
libraries/ghc-internal/src/GHC/Internal/Data/Data.hs
=====================================
@@ -116,7 +116,7 @@ import GHC.Internal.Data.Eq
import GHC.Internal.Data.Maybe
import GHC.Internal.Data.Monoid
import GHC.Internal.Data.NonEmpty ( NonEmpty(..) )
-import GHC.Internal.Data.Ord
+import GHC.Internal.Data.Ord.Down
import GHC.Internal.Data.OldList (findIndex)
import GHC.Internal.Data.Typeable
import GHC.Internal.Data.Version( Version(..) )
=====================================
libraries/ghc-internal/src/GHC/Internal/Data/Foldable.hs
=====================================
@@ -921,9 +921,6 @@ deriving instance Foldable UInt
-- | @since base-4.9.0.0
deriving instance Foldable UWord
--- Instances for Data.Ord
--- | @since base-4.12.0.0
-deriving instance Foldable Down
-- | Right-to-left monadic fold over the elements of a structure.
--
=====================================
libraries/ghc-internal/src/GHC/Internal/Data/Ord.hs
=====================================
@@ -19,21 +19,11 @@
module GHC.Internal.Data.Ord (
Ord(..),
Ordering(..),
- Down(..),
comparing,
clamp,
) where
-import GHC.Internal.Data.Bits (Bits, FiniteBits, complement)
-import GHC.Internal.Foreign.Storable (Storable)
-import GHC.Internal.Ix (Ix)
import GHC.Internal.Base
-import GHC.Internal.Enum (Bounded(..), Enum(..))
-import GHC.Internal.Float (Floating, RealFloat)
-import GHC.Internal.Num
-import GHC.Internal.Read
-import GHC.Internal.Real (Fractional, Real, RealFrac)
-import GHC.Internal.Show
-- $setup
-- >>> import Prelude
@@ -68,115 +58,3 @@ comparing p x y = compare (p x) (p y)
-- @since base-4.16.0.0
clamp :: (Ord a) => (a, a) -> a -> a
clamp (low, high) a = min high (max a low)
-
--- | The 'Down' type allows you to reverse sort order conveniently. A value of type
--- @'Down' a@ contains a value of type @a@ (represented as @'Down' a@).
---
--- If @a@ has an @'Ord'@ instance associated with it then comparing two
--- values thus wrapped will give you the opposite of their normal sort order.
--- This is particularly useful when sorting in generalised list comprehensions,
--- as in: @then sortWith by 'Down' x@.
---
--- >>> compare True False
--- GT
---
--- >>> compare (Down True) (Down False)
--- LT
---
--- If @a@ has a @'Bounded'@ instance then the wrapped instance also respects
--- the reversed ordering by exchanging the values of @'minBound'@ and
--- @'maxBound'@.
---
--- >>> minBound :: Int
--- -9223372036854775808
---
--- >>> minBound :: Down Int
--- Down 9223372036854775807
---
--- All other instances of @'Down' a@ behave as they do for @a@.
---
--- @since base-4.6.0.0
-newtype Down a = Down
- { getDown :: a -- ^ @since base-4.14.0.0
- }
- deriving
- ( Eq -- ^ @since base-4.6.0.0
- , Num -- ^ @since base-4.11.0.0
- , Semigroup -- ^ @since base-4.11.0.0
- , Monoid -- ^ @since base-4.11.0.0
- , Bits -- ^ @since base-4.14.0.0
- , FiniteBits -- ^ @since base-4.14.0.0
- , Floating -- ^ @since base-4.14.0.0
- , Fractional -- ^ @since base-4.14.0.0
- , Ix -- ^ @since base-4.14.0.0
- , Real -- ^ @since base-4.14.0.0
- , RealFrac -- ^ @since base-4.14.0.0
- , RealFloat -- ^ @since base-4.14.0.0
- , Storable -- ^ @since base-4.14.0.0
- )
-
--- | This instance would be equivalent to the derived instances of the
--- 'Down' newtype if the 'getDown' field were removed
---
--- @since base-4.7.0.0
-instance (Read a) => Read (Down a) where
- readsPrec d = readParen (d > 10) $ \ r ->
- [(Down x,t) | ("Down",s) <- lex r, (x,t) <- readsPrec 11 s]
-
--- | This instance would be equivalent to the derived instances of the
--- 'Down' newtype if the 'getDown' field were removed
---
--- @since base-4.7.0.0
-instance (Show a) => Show (Down a) where
- showsPrec d (Down x) = showParen (d > 10) $
- showString "Down " . showsPrec 11 x
-
--- | @since base-4.6.0.0
-instance Ord a => Ord (Down a) where
- compare (Down x) (Down y) = y `compare` x
- Down x < Down y = y < x
- Down x > Down y = y > x
- Down x <= Down y = y <= x
- Down x >= Down y = y >= x
- min (Down x) (Down y) = Down (max y x)
- max (Down x) (Down y) = Down (min y x)
-
--- | Swaps @'minBound'@ and @'maxBound'@ of the underlying type.
---
--- @since base-4.14.0.0
-instance Bounded a => Bounded (Down a) where
- minBound = Down maxBound
- maxBound = Down minBound
-
--- | Swaps @'succ'@ and @'pred'@ of the underlying type.
---
--- @since base-4.18.0.0
-instance (Enum a, Bounded a, Eq a) => Enum (Down a) where
- succ = fmap pred
- pred = fmap succ
-
- -- Here we use the fact that 'comparing (complement @Int)' behaves
- -- as an order-swapping `compare @Int`.
- fromEnum = complement . fromEnum . getDown
- toEnum = Down . toEnum . complement
-
- enumFrom (Down x)
- | x == minBound
- = [Down x] -- We can't rely on 'enumFromThen _ (pred @a minBound)` behaving nicely,
- -- since 'enumFromThen _' might be strict and 'pred minBound' might throw
- | otherwise
- = coerce $ enumFromThen x (pred x)
- enumFromThen (Down x) (Down y) = coerce $ enumFromThen x y
-
--- | @since base-4.11.0.0
-instance Functor Down where
- fmap = coerce
-
--- | @since base-4.11.0.0
-instance Applicative Down where
- pure = Down
- (<*>) = coerce
-
--- | @since base-4.11.0.0
-instance Monad Down where
- Down a >>= k = k a
=====================================
libraries/ghc-internal/src/GHC/Internal/Data/Ord/Down.hs
=====================================
@@ -0,0 +1,169 @@
+{-# LANGUAGE Trustworthy #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE DeriveFoldable #-}
+{-# LANGUAGE DeriveTraversable #-}
+{-# LANGUAGE StandaloneDeriving #-}
+
+-----------------------------------------------------------------------------
+-- |
+-- Module : GHC.Internal.Data.Ord.Down
+-- Copyright : (c) The University of Glasgow 2005
+-- License : BSD-style (see the file libraries/base/LICENSE)
+--
+-- Maintainer : libraries(a)haskell.org
+-- Stability : stable
+-- Portability : portable
+--
+-- Orderings
+--
+-----------------------------------------------------------------------------
+
+module GHC.Internal.Data.Ord.Down (
+ Down(..),
+ ) where
+
+import GHC.Internal.Data.Bits (Bits, FiniteBits, complement)
+import GHC.Internal.Ix (Ix)
+import GHC.Internal.Foreign.Storable (Storable)
+import GHC.Internal.Base
+import GHC.Internal.Enum (Bounded(..), Enum(..))
+import GHC.Internal.Float (Floating, RealFloat)
+import GHC.Internal.Num
+import GHC.Internal.Read
+import GHC.Internal.Real (Fractional, Real, RealFrac)
+import GHC.Internal.Show
+import GHC.Internal.Generics
+import GHC.Internal.Data.Foldable
+import GHC.Internal.Data.Traversable
+import GHC.Internal.Control.Monad.Zip
+
+-- $setup
+-- >>> import Prelude
+
+-- | The 'Down' type allows you to reverse sort order conveniently. A value of type
+-- @'Down' a@ contains a value of type @a@ (represented as @'Down' a@).
+--
+-- If @a@ has an @'Ord'@ instance associated with it then comparing two
+-- values thus wrapped will give you the opposite of their normal sort order.
+-- This is particularly useful when sorting in generalised list comprehensions,
+-- as in: @then sortWith by 'Down' x@.
+--
+-- >>> compare True False
+-- GT
+--
+-- >>> compare (Down True) (Down False)
+-- LT
+--
+-- If @a@ has a @'Bounded'@ instance then the wrapped instance also respects
+-- the reversed ordering by exchanging the values of @'minBound'@ and
+-- @'maxBound'@.
+--
+-- >>> minBound :: Int
+-- -9223372036854775808
+--
+-- >>> minBound :: Down Int
+-- Down 9223372036854775807
+--
+-- All other instances of @'Down' a@ behave as they do for @a@.
+--
+-- @since base-4.6.0.0
+newtype Down a = Down
+ { getDown :: a -- ^ @since base-4.14.0.0
+ }
+ deriving
+ ( Eq -- ^ @since base-4.6.0.0
+ , Num -- ^ @since base-4.11.0.0
+ , Semigroup -- ^ @since base-4.11.0.0
+ , Monoid -- ^ @since base-4.11.0.0
+ , Bits -- ^ @since base-4.14.0.0
+ , FiniteBits -- ^ @since base-4.14.0.0
+ , Floating -- ^ @since base-4.14.0.0
+ , Fractional -- ^ @since base-4.14.0.0
+ , Ix -- ^ @since base-4.14.0.0
+ , Real -- ^ @since base-4.14.0.0
+ , RealFrac -- ^ @since base-4.14.0.0
+ , RealFloat -- ^ @since base-4.14.0.0
+ , Storable -- ^ @since base-4.14.0.0
+ , Generic -- ^ @since base-4.12.0.0
+ )
+
+-- | @since base-4.12.0.0
+deriving instance Generic1 Down
+
+-- | @since base-4.12.0.0
+deriving instance Foldable Down
+
+-- | @since base-4.12.0.0
+deriving instance Traversable Down
+
+-- | @since 4.12.0.0
+instance MonadZip Down where
+ mzipWith = liftM2
+
+-- | This instance would be equivalent to the derived instances of the
+-- 'Down' newtype if the 'getDown' field were removed
+--
+-- @since base-4.7.0.0
+instance (Read a) => Read (Down a) where
+ readsPrec d = readParen (d > 10) $ \ r ->
+ [(Down x,t) | ("Down",s) <- lex r, (x,t) <- readsPrec 11 s]
+
+-- | This instance would be equivalent to the derived instances of the
+-- 'Down' newtype if the 'getDown' field were removed
+--
+-- @since base-4.7.0.0
+instance (Show a) => Show (Down a) where
+ showsPrec d (Down x) = showParen (d > 10) $
+ showString "Down " . showsPrec 11 x
+
+-- | @since base-4.6.0.0
+instance Ord a => Ord (Down a) where
+ compare (Down x) (Down y) = y `compare` x
+ Down x < Down y = y < x
+ Down x > Down y = y > x
+ Down x <= Down y = y <= x
+ Down x >= Down y = y >= x
+ min (Down x) (Down y) = Down (max y x)
+ max (Down x) (Down y) = Down (min y x)
+
+-- | Swaps @'minBound'@ and @'maxBound'@ of the underlying type.
+--
+-- @since base-4.14.0.0
+instance Bounded a => Bounded (Down a) where
+ minBound = Down maxBound
+ maxBound = Down minBound
+
+-- | Swaps @'succ'@ and @'pred'@ of the underlying type.
+--
+-- @since base-4.18.0.0
+instance (Enum a, Bounded a, Eq a) => Enum (Down a) where
+ succ = fmap pred
+ pred = fmap succ
+
+ -- Here we use the fact that 'comparing (complement @Int)' behaves
+ -- as an order-swapping `compare @Int`.
+ fromEnum = complement . fromEnum . getDown
+ toEnum = Down . toEnum . complement
+
+ enumFrom (Down x)
+ | x == minBound
+ = [Down x] -- We can't rely on 'enumFromThen _ (pred @a minBound)` behaving nicely,
+ -- since 'enumFromThen _' might be strict and 'pred minBound' might throw
+ | otherwise
+ = coerce $ enumFromThen x (pred x)
+ enumFromThen (Down x) (Down y) = coerce $ enumFromThen x y
+
+-- | @since base-4.11.0.0
+instance Functor Down where
+ fmap = coerce
+
+-- | @since base-4.11.0.0
+instance Applicative Down where
+ pure = Down
+ (<*>) = coerce
+
+-- | @since base-4.11.0.0
+instance Monad Down where
+ Down a >>= k = k a
=====================================
libraries/ghc-internal/src/GHC/Internal/Data/Traversable.hs
=====================================
@@ -46,7 +46,6 @@ import GHC.Internal.Data.Functor.Identity ( Identity(..) )
import GHC.Internal.Data.Functor.Utils ( StateL(..), StateR(..), StateT(..), (#.) )
import GHC.Internal.Data.Monoid ( Dual(..), Sum(..), Product(..),
First(..), Last(..), Alt(..), Ap(..) )
-import GHC.Internal.Data.Ord ( Down(..) )
import GHC.Internal.Data.Proxy ( Proxy(..) )
import GHC.Internal.Arr
@@ -364,10 +363,6 @@ deriving instance Traversable UInt
-- | @since base-4.9.0.0
deriving instance Traversable UWord
--- Instance for Data.Ord
--- | @since base-4.12.0.0
-deriving instance Traversable Down
-
-- general functions
-- | 'for' is 'traverse' with its arguments flipped. For a version
=====================================
libraries/ghc-internal/src/GHC/Internal/Exts.hs
=====================================
@@ -318,7 +318,7 @@ import qualified GHC.Internal.Data.Coerce
import GHC.Internal.Data.String
import GHC.Internal.Data.OldList
import GHC.Internal.Data.Data
-import GHC.Internal.Data.Ord
+import GHC.Internal.Data.Ord.Down
import qualified GHC.Internal.Debug.Trace
import GHC.Internal.Unsafe.Coerce ( unsafeCoerce# ) -- just for re-export
=====================================
libraries/ghc-internal/src/GHC/Internal/Generics.hs
=====================================
@@ -732,7 +732,6 @@ module GHC.Internal.Generics (
-- We use some base types
import GHC.Internal.Data.Either ( Either (..) )
import GHC.Internal.Data.Maybe ( Maybe(..), fromMaybe )
-import GHC.Internal.Data.Ord ( Down(..) )
import GHC.Internal.Bignum.Integer ( Integer, integerToInt )
import GHC.Internal.Prim ( Addr#, Char#, Double#, Float#, Int#, Word# )
import GHC.Internal.Ptr ( Ptr(..) )
@@ -1629,9 +1628,6 @@ deriving instance Generic ((,,,,,,,,,,,,,) a b c d e f g h i j k l m n)
-- | @since base-4.16.0.0
deriving instance Generic ((,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o)
--- | @since base-4.12.0.0
-deriving instance Generic (Down a)
-
-- | @since base-4.15.0.0
deriving instance Generic SrcLoc
@@ -1701,9 +1697,6 @@ deriving instance Generic1 ((,,,,,,,,,,,,,) a b c d e f g h i j k l m)
-- | @since base-4.16.0.0
deriving instance Generic1 ((,,,,,,,,,,,,,,) a b c d e f g h i j k l m n)
--- | @since base-4.12.0.0
-deriving instance Generic1 Down
-
--------------------------------------------------------------------------------
-- Copied from the singletons package
--------------------------------------------------------------------------------
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c7cab14210c2578d36933856b158f67…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c7cab14210c2578d36933856b158f67…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/T26834] 10 commits: Export labelThread from Control.Concurrent
by Teo Camarasu (@teo) 28 Jan '26
by Teo Camarasu (@teo) 28 Jan '26
28 Jan '26
Teo Camarasu pushed to branch wip/T26834 at Glasgow Haskell Compiler / GHC
Commits:
917ab8ff by Oleg Grenrus at 2026-01-23T10:52:55-05:00
Export labelThread from Control.Concurrent
- - - - -
3f5e8d80 by Cheng Shao at 2026-01-23T10:53:37-05:00
ci: only push perf notes on master/release branches
This patch fixes push_perf_notes logic in ci.sh to only push perf
notes on master/release branches. We used to unconditionally push perf
notes even in MRs, but the perf numbers in the wip branches wouldn't
be used as baseline anyway, plus this is causing a space leak in the
ghc-performance-notes repo. See #25317 for the perf notes repo size
problem.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
414b9593 by Cheng Shao at 2026-01-24T07:11:51-05:00
ci: remove duplicate keys in .gitlab-ci.yml
This patch removes accidentally duplicate keys in `.gitlab-ci.yml`.
The YAML spec doesn't allow duplicate keys in the first place, and
according to GitLab docs
(https://docs.gitlab.com/ci/yaml/yaml_optimization/#anchors) the
latest key overrides the earlier entries.
- - - - -
e5cb5491 by Cheng Shao at 2026-01-24T07:12:34-05:00
hadrian: drop obsolete configure/make builder logic for libffi
This patch drops obsolete hadrian logic around `Configure
libffiPath`/`Make libffiPath` builders, they are no longer needed
after libffi-clib has landed. Closes #26815.
- - - - -
2d160222 by Simon Hengel at 2026-01-24T07:13:17-05:00
Fix typo in roles.rst
- - - - -
f27e1720 by Teo Camarasu at 2026-01-28T17:21:52+00:00
ghc-internal: refine imports of GHC.Internal.Data.Bool
- - - - -
0cadd7c4 by Teo Camarasu at 2026-01-28T17:21:52+00:00
Delete unecessary GHC.Internal.Data.Ix
- - - - -
f8955f89 by Teo Camarasu at 2026-01-28T17:21:53+00:00
ghc-internal: refine List imports
- - - - -
6a8a5771 by Teo Camarasu at 2026-01-28T17:21:53+00:00
Move MonadFix Identity into Monad.Fix
- - - - -
4e6dc6e2 by Teo Camarasu at 2026-01-28T18:56:36+00:00
Split out GHC.Internal.Data.Ord.Down
- - - - -
40 changed files:
- .gitlab-ci.yml
- .gitlab/ci.sh
- docs/users_guide/exts/roles.rst
- hadrian/src/Context.hs
- hadrian/src/Settings/Builders/Configure.hs
- hadrian/src/Settings/Builders/Make.hs
- libraries/base/changelog.md
- libraries/base/src/Control/Concurrent.hs
- libraries/base/src/Data/Ix.hs
- libraries/base/src/System/Timeout.hs
- libraries/ghc-internal/ghc-internal.cabal.in
- libraries/ghc-internal/src/GHC/Internal/Control/Monad/Fix.hs
- libraries/ghc-internal/src/GHC/Internal/Control/Monad/Zip.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Data.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Foldable.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Function.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Functor/Identity.hs
- − libraries/ghc-internal/src/GHC/Internal/Data/Ix.hs
- libraries/ghc-internal/src/GHC/Internal/Data/List/NonEmpty.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Ord.hs
- + libraries/ghc-internal/src/GHC/Internal/Data/Ord/Down.hs
- libraries/ghc-internal/src/GHC/Internal/Data/String.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Traversable.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Type/Bool.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Version.hs
- libraries/ghc-internal/src/GHC/Internal/Event/Windows.hsc
- libraries/ghc-internal/src/GHC/Internal/ExecutionStack/Internal.hsc
- libraries/ghc-internal/src/GHC/Internal/Generics.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Encoding/CodePage.hs
- libraries/ghc-internal/src/GHC/Internal/ResponseFile.hs
- libraries/ghc-internal/src/GHC/Internal/Stack/Decode.hs
- libraries/ghc-internal/src/GHC/Internal/System/Environment/Blank.hsc
- libraries/ghc-internal/src/GHC/Internal/System/Environment/ExecutablePath.hsc
- libraries/ghc-internal/src/GHC/Internal/System/Posix/Internals.hs
- libraries/ghc-internal/src/GHC/Internal/TypeError.hs
- libraries/ghc-internal/src/GHC/Internal/Windows.hs
- 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
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/87d4f2db41df1fe9dcba99268611b8…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/87d4f2db41df1fe9dcba99268611b8…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/andreask/ticked_joins] Allow join point Ids to occur below ticks & casts
by sheaf (@sheaf) 28 Jan '26
by sheaf (@sheaf) 28 Jan '26
28 Jan '26
sheaf pushed to branch wip/andreask/ticked_joins at Glasgow Haskell Compiler / GHC
Commits:
0b1e947b by sheaf at 2026-01-28T19:53:46+01:00
Allow join point Ids to occur below ticks & casts
This commit classifies all join points into two categories:
- true join points
- quasi join points
A quasi join point is a join point for which a jump is enclosed within
a profiling tick or a cast.
The only operational difference is that, for quasi join points, we
cannot perform the case-of-case transformation described in
Note [Join points and case-of-case] in GHC.Core.Opt.Simplify.Iteration.
All of this is explained in detail in Note [Quasi join points].
Fixes #26693 and #26642
Improves on #14610, #26157 and #26422, as it means casts/profiling ticks
don't prevent join points, but it doesn't entirely fix these issues
because we are still inhibiting optimisations (lack of case-of-case).
- - - - -
31 changed files:
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/CSE.hs
- compiler/GHC/Core/Opt/Exitify.hs
- compiler/GHC/Core/Opt/FloatIn.hs
- compiler/GHC/Core/Opt/FloatOut.hs
- compiler/GHC/Core/Opt/OccurAnal.hs
- compiler/GHC/Core/Opt/SetLevels.hs
- compiler/GHC/Core/Opt/Simplify/Env.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/Simplify/Monad.hs
- compiler/GHC/Core/Opt/SpecConstr.hs
- compiler/GHC/Core/Opt/Specialise.hs
- compiler/GHC/Core/Opt/WorkWrap.hs
- compiler/GHC/Core/Opt/WorkWrap/Utils.hs
- compiler/GHC/Core/Ppr.hs
- compiler/GHC/Core/Rules.hs
- compiler/GHC/Core/SimpleOpt.hs
- compiler/GHC/Core/Tidy.hs
- compiler/GHC/Core/Unfold.hs
- compiler/GHC/Core/Utils.hs
- compiler/GHC/CoreToStg/Prep.hs
- compiler/GHC/Types/Basic.hs
- compiler/GHC/Types/Id.hs
- compiler/GHC/Types/Id/Info.hs
- compiler/GHC/Types/Tickish.hs
- compiler/GHC/Utils/Binary.hs
- compiler/GHC/Utils/Outputable.hs
- testsuite/tests/profiling/should_run/T2552.prof.sample
- testsuite/tests/profiling/should_run/ioprof.prof.sample
- testsuite/tests/profiling/should_run/scc001.prof.sample
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0b1e947b23e82c455d30556090df480…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0b1e947b23e82c455d30556090df480…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/T26548] 58 commits: Improve newtype unwrapping
by Simon Peyton Jones (@simonpj) 28 Jan '26
by Simon Peyton Jones (@simonpj) 28 Jan '26
28 Jan '26
Simon Peyton Jones pushed to branch wip/T26548 at Glasgow Haskell Compiler / GHC
Commits:
29c0aceb by Simon Peyton Jones at 2026-01-16T17:18:11-05:00
Improve newtype unwrapping
Ticket #26746 describes several relatively-minor shortcomings of newtype
unwrapping. This MR addresses them, while also (arguably) simplifying
the code a bit.
See new Note [Solving newtype equalities: overview]
and Note [Decomposing newtype equalities]
and Note [Eager newtype decomposition]
and Note [Even more eager newtype decomposition]
For some reason, on Windows only, runtime allocations decrease for test
T5205 (from 52k to 48k). I have not idea why. No change at all on Linux.
I'm just going to accept the change. (I saw this same effect in another
MR so I think it's a fault in the baseline.)
Metric Decrease:
T5205
- - - - -
8b59e62c by Andreas Klebinger at 2026-01-16T17:18:52-05:00
testsuite: Widen acceptance window for T5205.
Fixes #26782
- - - - -
9e5e0234 by mangoiv at 2026-01-17T06:03:03-05:00
add a new issue template for getting verified
To reduce spam created by new users, we will in future not grant
any rights but reporting issues to new users. That is why we will
have to be able to verify them. The added issue template serves that
purpose.
- - - - -
b18b2c42 by Cheng Shao at 2026-01-17T06:03:44-05:00
llvm: fix split sections for llvm backend
This patch fixes split sections for llvm backend:
- Pass missing `--data-sections`/`--function-sections` flags to
llc/opt.
- Use `(a)llvm.compiler.used` instead of `(a)llvm.used` to avoid sections
being unnecessarily retained at link-time.
Fixes #26770.
-------------------------
Metric Decrease:
libdir
size_hello_artifact
size_hello_unicode
-------------------------
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
ebf66f67 by Cheng Shao at 2026-01-17T13:16:50-05:00
Update autoconf scripts
Scripts taken from autoconf a2287c3041a3f2a204eb942e09c015eab00dc7dd
- - - - -
598624b9 by Andreas Klebinger at 2026-01-17T13:17:32-05:00
CString.hs: Update incorrect comment.
Fixes #26322
- - - - -
eea2036b by Cheng Shao at 2026-01-18T10:00:49-05:00
libraries: bump haskeline submodule to 0.8.4.1
This patch bumps the haskeline submodule to 0.8.4.1 which includes an
important fix for an ANSI handling bug on Windows
(https://github.com/haskell/haskeline/pull/126)
- - - - -
87d8f6c2 by Cheng Shao at 2026-01-18T10:01:30-05:00
hadrian: replace default -H32m/-H64m with -O64M to improve mutator productivity
Most hadrian build flavours pass `-H32m`/`-H64m` to GHC as
conventional wisdom to improve mutator productivity and reduce GC
overhead. They were inherited from the legacy Make build system, and
there used to be make flags to instrument a build process with
`-Rghc-timing` option to collect GC stats of each GHC run from stderr.
It's time to revisit whether there are better defaults for
`-H32m`/`-H64m`, and this patch changes it to `-O64M` which indeed
improves mutator productivity based on real statistics. `-O64M` is
more aggressive than `-H64m`; it allows the old generation to grow to
at least 64M before triggering major GC and reduces major GC runs.
The stats of a clean build with `validate` flavour and `-H64m`:
```
h64m.log
matched RTS stat lines: 5499
sum MUT cpu : 2400.808 s
sum GC cpu : 1378.292 s
sum MUT elapsed : 2788.253 s
sum GC elapsed : 1389.233 s
GC/MUT cpu ratio : 0.574 (GC is 57.4% of MUT)
GC/MUT elapsed ratio : 0.498 (GC is 49.8% of MUT)
GC fraction of (MUT+GC) cpu : 36.5%
GC fraction of (MUT+GC) elapsed : 33.3%
per-line GC/MUT cpu ratio: median 0.691, p90 1.777
per-line GC/MUT elapsed ratio: median 0.519, p90 1.081
```
The stats of a clean build with `validate` flavour and `-O64M`:
```
o64m.log
matched RTS stat lines: 5499
sum MUT cpu : 2377.383 s
sum GC cpu : 1127.146 s
sum MUT elapsed : 2758.857 s
sum GC elapsed : 1135.587 s
GC/MUT cpu ratio : 0.474 (GC is 47.4% of MUT)
GC/MUT elapsed ratio : 0.412 (GC is 41.2% of MUT)
GC fraction of (MUT+GC) cpu : 32.2%
GC fraction of (MUT+GC) elapsed : 29.2%
per-line GC/MUT cpu ratio: median 0.489, p90 1.099
per-line GC/MUT elapsed ratio: median 0.367, p90 0.806
```
Mutator time is roughly in the same ballpark, but GC CPU time has
reduced by 18.22%, and mutator productivity has increased from 63.5%
to 67.8%.
- - - - -
8372e13d by Cheng Shao at 2026-01-18T10:02:12-05:00
rts: remove unused .def files from rts/win32
This patch removes unused .def files from `rts/win32`, given we don't
build .dll files for rts/ghc-internal/ghc-prim at all. Even when we
resurrect win32 dll support at some point in the future, these .def
files still contain incorrect symbols anyway and won't be of any use.
- - - - -
f6af485d by Cheng Shao at 2026-01-18T10:03:19-05:00
.gitmodules: use gitlab mirror for the libffi-clib submodule
This patch fixes .gitmodules to use the gitlab mirror for the
libffi-clib submodule, to make it coherent with other submodules that
allow ghc developers to experiment with wip branches in submodules for
ghc patches. Fixes #26783.
- - - - -
41432d25 by Cheng Shao at 2026-01-18T10:05:13-05:00
hadrian: remove the horrible i386 speedHack
When hadrian builds certain rts objects for i386, there's a horrible
speedHack that forces -fno-PIC even for dynamic ways of those objects.
This is not compatible with newer versions of gcc/binutils as well as
clang/lld, and this patch removes it. Fixes #26792.
- - - - -
323eb8f0 by Cheng Shao at 2026-01-18T21:48:19-05:00
hadrian: enable split sections for cross stage0
This patch fixes a minor issue with `splitSectionsArgs` in hadrian:
previously, it's unconditionally disabled for stage0 libraries because
it's not going to be shipped in the final bindists. But it's only true
when not cross compiling. So for now we also need to enable it for
cross stage0 as well.
- - - - -
3fadfefe by Andreas Klebinger at 2026-01-18T21:49:01-05:00
RTS: Document -K behaviour better
- - - - -
30f442a9 by Teo Camarasu at 2026-01-20T13:57:26-05:00
base: don't expose GHC.Num.{BigNat, Integer, Natural}
We no longer expose GHC.Num.{BigNat, Integer, Natural} from base instead users should get these modules from ghc-bignum.
We make this change to insulate end users from changes to GHC's implementation of big numbers.
Implements CLC proposal 359: https://github.com/haskell/core-libraries-committee/issues/359
- - - - -
75a9053d by Teo Camarasu at 2026-01-20T13:58:07-05:00
base: deprecate GHC internals in GHC.Num
Implements CLC proposal: https://github.com/haskell/core-libraries-committee/issues/360
- - - - -
9534b032 by Andreas Klebinger at 2026-01-20T13:58:50-05:00
ghc-experimental: Update Changelog
I tried to reconstruct a high level overview of the changes and when
they were made since we introduced it.
Fixes #26506
Co-authored-by: Teo Camarasu <teofilcamarasu(a)gmail.com>
- - - - -
346f2f5a by Cheng Shao at 2026-01-20T13:59:30-05:00
hadrian: remove RTS options in ghc-in-ghci flavour
This patch removes the RTS options passed to ghc in ghc-in-ghci
flavour, to workaround command line argument handling issue in
hls/hie-boot that results in `-O64M` instead of `+RTS -O64M -RTS`
being passed to ghc. It's not a hadrian bug per se, since ghc's own
ghc-in-ghci multi repl works fine, but we should still make sure HLS
works. Closes #26801.
- - - - -
759fd15a by Andreas Klebinger at 2026-01-21T16:05:28-05:00
Don't build GHC with -Wcompat
Without bumping the boot compiler the warnings it produces are often not
actionable leading to pointless noise.
Fixes #26800
- - - - -
3172db94 by Torsten Schmits at 2026-01-21T16:06:11-05:00
Use the correct field of ModOrigin when formatting error message listing hidden reexports
- - - - -
485c12b2 by Cheng Shao at 2026-01-21T16:06:54-05:00
Revert "hadrian: handle findExecutable "" gracefully"
This reverts commit 1e5752f64a522c4025365856d92f78073a7b3bba. The
underlying issue has been fixed in
https://github.com/haskell/directory/commit/75828696e7145adc09179111a0d631b…
and present since 1.3.9.0, and hadrian directory lower bound is
1.3.9.0, so we can revert our own in house hack now.
- - - - -
5efb58dc by Cheng Shao at 2026-01-21T16:07:36-05:00
rts: fix typo in TICK_ALLOC_RTS
This patch fixes a typo in the `TICK_ALLOC_RTS` macro, the original
`bytes` argument was silently dropped. The Cmm code has its own
version of `TICK_ALLOC_RTS` not affected by this typo, it affected the
C RTS, and went unnoticed because the variable `n` happened to also be
available at its call site. But the number was incorrect. Also fixes
its call site since `WDS()` is not available in C.
- - - - -
c406ea69 by Cheng Shao at 2026-01-21T16:07:36-05:00
rts: remove broken & unused ALLOC_P_TICKY
This patch removes the `ALLOC_P_TICKY` macro from the rts, it's
unused, and its expanded code is already broken.
- - - - -
34a27e20 by Simon Peyton Jones at 2026-01-21T16:08:17-05:00
Make the implicit-parameter class have representational role
This MR addresses #26737, by making the built-in class IP
have a representational role for its second parameter.
See Note [IP: implicit parameter class] in
ghc-internal:GHC.Internal.Classes.IP
In fact, IP is (unfortunately, currently) exposed by
base:GHC.Base, so we ran a quick CLC proposal to
agree the change:
https://github.com/haskell/core-libraries-committee/issues/385
Some (small) compilations get faster because they only need to
load (small) interface file GHC.Internal.Classes.IP.hi,
rather than (large) GHC.Internal.Classes.hi.
Metric Decrease:
T10421
T12150
T12425
T24582
T5837
T5030
- - - - -
ca79475f by Cheng Shao at 2026-01-21T16:09:00-05:00
testsuite: avoid re.sub in favor of simple string replacements
This patch refactors the testsuite driver and avoids the usage of
re.sub in favor of simple string replacements when possible. The
changes are not comprehensive, and there are still a lot of re.sub
usages lingering around the tree, but this already addresses a major
performance bottleneck in the testsuite driver that might has to do
with quadratic or worse slowdown in cpython's regular expression
engine when handling certain regex patterns with large strings.
Especially on i386, and i386 jobs are the bottlenecks of all full-ci
validate pipelines!
Here are the elapsed times of testing x86_64/i386 with -j48 before
this patch:
x86_64: `Build completed in 6m06s`
i386: `Build completed in 1h36m`
And with this patch:
x86_64: `Build completed in 4m55s`
i386: `Build completed in 4m23s`
Fixes #26786.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
88c93796 by Zubin Duggal at 2026-01-21T16:09:42-05:00
ghc-toolchain: Also configure windres on non-windows platforms.
It may be needed for cross compilation.
Fixes #24588
- - - - -
9788c0ec by Cheng Shao at 2026-01-21T16:10:24-05:00
ghci: print external interpreter trace messages to stderr instead of stdout
This patch makes ghci print external interpreter trace messages to
stderr instead of stdout, which is a much saner choice for diagnostic
information. Closes #26807.
- - - - -
0491f08a by Sylvain Henry at 2026-01-22T03:44:26-05:00
GC: don't use CAS without PARALLEL_GC on
If we're not using the parallel GC, there is no reason to do a costly
CAS. This was flagged as taking time in a perf profile.
- - - - -
211a8f56 by Sylvain Henry at 2026-01-22T03:44:26-05:00
GC: suffix parallel GC with "par" instead of "thr"
Avoid some potential confusion (see discussion in !15351).
- - - - -
77a23cbd by fendor at 2026-01-22T03:45:08-05:00
Remove blanket ignore that covers libraries/
- - - - -
18bf7f5c by Léana Jiang at 2026-01-22T08:58:45-05:00
doc: update Flavour type in hadrian user-settings
- - - - -
3d5a1365 by Cheng Shao at 2026-01-22T08:59:28-05:00
hadrian: add missing notCross predicate for stage0 -O0
There are a few hard-coded hadrian args that pass -O0 when compiling
some heavy modules in stage0, which only makes sense when not
cross-compiling and when cross-compiling we need properly optimized
stage0 packages. So this patch adds the missing `notCross` predicate
in those places.
- - - - -
ee937134 by Matthew Pickering at 2026-01-22T09:00:10-05:00
Fix ghc-experimental GHC.Exception.Backtrace.Experimental module
This module wasn't added to the cabal file so it was never compiled or
included in the library.
- - - - -
1b490f5a by Zubin Duggal at 2026-01-22T09:00:53-05:00
hadrian: Add ghc-{experimental,internal}.cabal to the list of dependencies of the doc target
We need these files to detect the version of these libraries
Fixes #26738
- - - - -
cdb74049 by Cheng Shao at 2026-01-22T14:52:36-05:00
rts: avoid Cmm loop to initialize Array#/SmallArray#
Previously, `newArray#`/`newSmallArray#` called an RTS C function to
allocate the `Array#`/`SmallArray#`, then used a Cmm loop to
initialize the elements. Cmm doesn't have native for-loop so the code
is a bit awkward, and it's less efficient than a C loop, since the C
compiler can effectively vectorize the loop with optimizations.
So this patch moves the loop that initializes the elements to the C
side. `allocateMutArrPtrs`/`allocateSmallMutArrPtrs` now takes a new
`init` argument and initializes the elements if `init` is non-NULL.
- - - - -
4c784f00 by Cheng Shao at 2026-01-22T14:53:19-05:00
Fix testsuite run for +ipe flavour transformer
This patch makes the +ipe flavour transformer pass the entire
testsuite:
- An RTS debug option `-DI` is added, the IPE trace information is now
only printed with `-DI`. The test cases that do require IPE trace
are now run with `-DI`.
- The testsuite config option `ghc_with_ipe` is added, enabled when
running the testsuite with `+ipe`, which skips a few tests that are
sensitive to eventlog output, allocation patterns etc that can fail
under `+ipe`.
This is the first step towards #26799.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
be8e5236 by Ben Gamari at 2026-01-23T03:28:45-05:00
hadrian: Bump QuickCheck upper bound
This patch bumps QuickCheck upper bound to 2.18. selftest rule
manually tested to work with current latest QuickCheck-2.17.1.0.
- - - - -
5aa328fb by Zubin Duggal at 2026-01-23T03:29:30-05:00
Add genindex to index.rst. This adds a link to the index in the navigation bar.
Fixes #26437
- - - - -
917ab8ff by Oleg Grenrus at 2026-01-23T10:52:55-05:00
Export labelThread from Control.Concurrent
- - - - -
3f5e8d80 by Cheng Shao at 2026-01-23T10:53:37-05:00
ci: only push perf notes on master/release branches
This patch fixes push_perf_notes logic in ci.sh to only push perf
notes on master/release branches. We used to unconditionally push perf
notes even in MRs, but the perf numbers in the wip branches wouldn't
be used as baseline anyway, plus this is causing a space leak in the
ghc-performance-notes repo. See #25317 for the perf notes repo size
problem.
Co-authored-by: Codex <codex(a)openai.com>
- - - - -
414b9593 by Cheng Shao at 2026-01-24T07:11:51-05:00
ci: remove duplicate keys in .gitlab-ci.yml
This patch removes accidentally duplicate keys in `.gitlab-ci.yml`.
The YAML spec doesn't allow duplicate keys in the first place, and
according to GitLab docs
(https://docs.gitlab.com/ci/yaml/yaml_optimization/#anchors) the
latest key overrides the earlier entries.
- - - - -
e5cb5491 by Cheng Shao at 2026-01-24T07:12:34-05:00
hadrian: drop obsolete configure/make builder logic for libffi
This patch drops obsolete hadrian logic around `Configure
libffiPath`/`Make libffiPath` builders, they are no longer needed
after libffi-clib has landed. Closes #26815.
- - - - -
2d160222 by Simon Hengel at 2026-01-24T07:13:17-05:00
Fix typo in roles.rst
- - - - -
56db94f7 by Peter Trommler at 2026-01-26T11:26:18+01:00
PPC NCG: Generate clear right insn at arch width
The clear right immediate (clrrxi) is only available in word and
doubleword width. Generate clrrxi instructions at architecture
width for all MachOp widths.
Fixes #24145
- - - - -
5957a8ad by Wolfgang Jeltsch at 2026-01-27T06:11:40-05:00
Add operations for obtaining operating-system handles
This contribution implements CLC proposal #369. It adds operations for
obtaining POSIX file descriptors and Windows handles that underlie
Haskell handles. Those operating system handles can also be obtained
without such additional operations, but this is more involved and, more
importantly, requires using internals.
- - - - -
86a0510c by Greg Steuck at 2026-01-27T06:12:34-05:00
Move flags to precede patterns for grep and read files directly
This makes the tests pass with non-GNU (i.e. POSIX-complicant) tools.
There's no reason to use cat and pipe where direct file argument works.
- - - - -
50761451 by Cheng Shao at 2026-01-27T21:51:23-05:00
ci: update darwin boot ghc to 9.10.3
This patch updates darwin boot ghc to 9.10.3, along with other related
updates, and pays off some technical debt here:
- Update `nixpkgs` and use the `nixpkgs-25.05-darwin` channel.
- Update the `niv` template.
- Update LLVM to 21 and update `llvm-targets` to reflect LLVM 21
layout changes for arm64/x86_64 darwin targets.
- Use `stdenvNoCC` to prevent nix packaged apple sdk from being used
by boot ghc, and manually set `DEVELOPER_DIR`/`SDKROOT` to enforce
the usage of system-wide command line sdk for macos.
- When building nix derivation for boot ghc, run `configure` via the
`arch` command so that `configure` and its subprocesses pick up the
manually specified architecture.
- Remove the previous horrible hack that obliterates `configure` to
make autoconf test result in true. `configure` now properly does its
job.
- Remove the now obsolete configure args and post install settings
file patching logic.
- Use `scheme-small` for texlive to avoid build failures in certain
unused texlive packages, especially on x86_64-darwin.
- - - - -
94dcd15e by Matthew Pickering at 2026-01-27T21:52:05-05:00
Evaluate backtraces for "error" exceptions at the moment they are thrown
See Note [Capturing the backtrace in throw] and
Note [Hiding precise exception signature in throw] which explain the
implementation.
This commit makes `error` and `throw` behave the same with regard to
backtraces. Previously, exceptions raised by `error` would not contain
useful IPE backtraces.
I did try and implement `error` in terms of `throw` but it started to
involve putting diverging functions into hs-boot files, which seemed to
risky if the compiler wouldn't be able to see if applying a function
would diverge.
CLC proposal: https://github.com/haskell/core-libraries-committee/issues/383
Fixes #26751
- - - - -
ef35e3ea by Teo Camarasu at 2026-01-27T21:52:46-05:00
ghc-internal: move all Data instances to Data.Data
Most instances of Data are defined in GHC.Internal.Data.Data.
Let's move all remaining instance there.
This moves other modules down in the dependency hierarchy allowing for
more parallelism, and it decreases the likelihood that we would need to
load this heavy .hi file if we don't actually need it.
Resolves #26830
Metric Decrease:
T12227
T16875
- - - - -
5e0ec555 by sheaf at 2026-01-28T06:56:38-05:00
Add test case for #25679
This commit adds the T25679 test case. The test now passes, thanks to
commit 1e53277af36d3f0b6ad5491f70ffc5593a49dcfd.
Fixes #25679
- - - - -
f1cd1611 by sheaf at 2026-01-28T06:56:38-05:00
Improve defaulting of representational equalities
This commit makes the defaulting of representational equalities, introduced
in 1e53277a, a little bit more robust. Now, instead of calling the eager
unifier, it calls the full-blown constraint solver, which means that it can
handle some subtle situations, e.g. involving functional dependencies and
type-family injectivity annotations, such as:
type family F a = r | r -> a
type instance F Int = Bool
[W] F beta ~R Bool
- - - - -
25edf516 by sheaf at 2026-01-28T06:56:38-05:00
Improve errors for unsolved representational equalities
This commit adds a new field of CtLoc, CtExplanations, which allows the
typechecker to leave some information about what it has done. For the moment,
it is only used to improve error messages for unsolved representational
equalities. The typechecker will now accumulate, when unifying at
representational role:
- out-of-scope newtype constructors,
- type constructors that have nominal role in a certain argument,
- over-saturated type constructors,
- AppTys, e.g. `c a ~R# c b`, to report that we must assume that 'c' has
nominal role in its parameters,
- data family applications that do not reduce, potentially preventing
newtype unwrapping.
Now, instead of having to re-construct the possible errors after the fact,
we simply consult the CtExplanations field.
Additionally, this commit modifies the typechecker error messages that
concern out-of-scope newtype constructors. The error message now depends
on whether we have an import suggestion to provide to the user:
- If we have an import suggestion for the newtype constructor,
the message will be of the form:
The data constructor MkN of the newtype N is out of scope
Suggested fix: add 'MkN' to the import list in the import of 'M'
- If we don't have any import suggestions, the message will be
of the form:
NB: The type 'N' is an opaque newtype, whose constructor is hidden
Fixes #15850, #20289, #20468, #23731, #25949, #26137
- - - - -
4d0e6da1 by Simon Peyton Jones at 2026-01-28T06:57:19-05:00
Fix two bugs in short-cut constraint solving
There are two main changes here:
* Use `isSolvedWC` rather than `isEmptyWC` in `tryShortCutSolver`
The residual constraint may have some fully-solved, but
still-there implications, and we don't want them to abort short
cut solving! That bug caused #26805.
* In the short-cut solver, we abandon the fully-solved residual
constraint; but we may thereby lose track of Givens that are
needed, and either report them as redundant or prune evidence
bindings that are in fact needed.
This bug stopped the `constraints` package from compiling;
see the trail in !15389.
The second bug led me to (another) significant refactoring
of the mechanism for tracking needed EvIds. See the new
Note [Tracking needed EvIds] in GHC.Tc.Solver.Solve
It's simpler and much less head-scratchy now.
Some particulars:
* An EvBindsVar now tracks NeededEvIds
* We deal with NeededEvIds for an implication only when it is
fully solved. Much simpler!
* `tryShortCutTcS` now takes a `TcM WantedConstraints` rather than
`TcM Bool`, so that is can plumb the needed EvIds correctly.
* Remove `ic_need` and `ic_need_implic` from Implication (hooray),
and add `ics_dm` and `ics_non_dm` to `IC_Solved`.
Pure refactor
* Shorten data constructor `CoercionHole` to `CH`, following
general practice in GHC.
* Rename `EvBindMap` to `EvBindsMap` for consistency
- - - - -
662480b7 by Cheng Shao at 2026-01-28T06:58:00-05:00
ci: use debian validate bindists instead of fedora release bindists in testing stage
This patch changes the `abi-test`, `hadrian-multi` and `perf` jobs in
the full-ci pipeline testing stage to use debian validate bindists
instead of fedora release bindists, to increase pipeline level
parallelism and allow full-ci pipelines to complete earlier. Closes #26818.
- - - - -
39581ec6 by Cheng Shao at 2026-01-28T06:58:40-05:00
ci: run perf test with -j$cores
This patch makes the perf ci job compile Cabal with -j$cores to speed
up the job.
- - - - -
7fbe71c1 by Simon Peyton Jones at 2026-01-28T17:38:37+00:00
Fix evaluated-ness bug in Simplifier
This fixes #26548, an error which meant that we were failing to
attach evaluated-ness flags to case-alternative-bound variables
- - - - -
fbf28b7a by Simon Peyton Jones at 2026-01-28T17:38:38+00:00
Be a little less eager to inline
---> OtherCon [] = TrivArg
OtherCon _ = NonTrivArg
Make inlining a tiny bit more eager
---> OtherCon [] = NonTrivArg
In particular
x = mkSymMCo mco
where mco is evaluated. We want that to inline, especially if the
let is strict. Makes a significant difference in Rewrite.hs,
Test case T9872b
OtherCon [] arguments aren't interesting
---> OtherCon [] = TrivArg
Remove white space
Be a little less keen to inline
This commit changes interestingArg to treat lambda as NonTrivArg
rather than ValueArg. That makes parser combinators a bit less
keen to inline. E.g.
<|> p1 p2 = \x -> case p1 x of
Yes -> ...
No -> ...
If we have a call (<|> arg1 arg2) where arg1 is a parser, and hence
often visibly a lambda, it's no so great to inline <|>, because we
are still stuck on x.
This affects for example T17516
Just an experiment.
- - - - -
1c03edfb by Simon Peyton Jones at 2026-01-28T17:38:38+00:00
Wibbles
In particular, a lambda is a value argument in interestingArg
For some reason I had changed this and it made many things worse
This wibble puts it back!
- - - - -
073afea6 by Simon Peyton Jones at 2026-01-28T17:38:38+00:00
Tracing in SpecConstr only
- - - - -
234 changed files:
- .gitignore
- .gitlab-ci.yml
- .gitlab/ci.sh
- .gitlab/darwin/nix/sources.json
- .gitlab/darwin/toolchain.nix
- + .gitlab/issue_templates/get-verified.md
- .gitmodules
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/CmmToAsm/PPC/CodeGen.hs
- compiler/GHC/CmmToLlvm.hs
- compiler/GHC/CmmToLlvm/Base.hs
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/FamInstEnv.hs
- compiler/GHC/Core/Opt/Simplify/Inline.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/Opt/SpecConstr.hs
- compiler/GHC/Core/Predicate.hs
- compiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Core/TyCo/Subst.hs
- compiler/GHC/Core/TyCo/Tidy.hs
- compiler/GHC/Core/TyCon/RecWalk.hs
- compiler/GHC/Data/Maybe.hs
- compiler/GHC/Driver/Pipeline/Execute.hs
- compiler/GHC/HsToCore/Pmc/Solver.hs
- compiler/GHC/Rename/Unbound.hs
- compiler/GHC/Tc/Errors.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Gen/Default.hs
- compiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Instance/Family.hs
- compiler/GHC/Tc/Solver/Default.hs
- compiler/GHC/Tc/Solver/Dict.hs
- compiler/GHC/Tc/Solver/Equality.hs
- compiler/GHC/Tc/Solver/InertSet.hs
- compiler/GHC/Tc/Solver/Monad.hs
- compiler/GHC/Tc/Solver/Solve.hs
- compiler/GHC/Tc/TyCl/Instance.hs
- compiler/GHC/Tc/Types/Constraint.hs
- compiler/GHC/Tc/Types/CtLoc.hs
- compiler/GHC/Tc/Types/Evidence.hs
- compiler/GHC/Tc/Types/Origin.hs
- compiler/GHC/Tc/Utils/Monad.hs
- compiler/GHC/Tc/Utils/TcMType.hs
- compiler/GHC/Tc/Utils/Unify.hs
- compiler/GHC/Tc/Zonk/TcType.hs
- compiler/GHC/Tc/Zonk/Type.hs
- compiler/GHC/Types/Error/Codes.hs
- compiler/GHC/Types/RepType.hs
- compiler/GHC/Types/Var.hs
- compiler/GHC/Unit/State.hs
- compiler/GHC/Utils/Monad.hs
- compiler/GHC/Utils/Trace.hs
- compiler/ghc.cabal.in
- config.guess
- config.sub
- docs/users_guide/9.16.1-notes.rst
- docs/users_guide/exts/roles.rst
- docs/users_guide/index.rst
- docs/users_guide/runtime_control.rst
- hadrian/doc/flavours.md
- hadrian/doc/user-settings.md
- hadrian/hadrian.cabal
- hadrian/src/Context.hs
- hadrian/src/Flavour.hs
- hadrian/src/Hadrian/Utilities.hs
- hadrian/src/Rules/Docspec.hs
- hadrian/src/Rules/Documentation.hs
- hadrian/src/Rules/Lint.hs
- hadrian/src/Settings/Builders/Configure.hs
- hadrian/src/Settings/Builders/Ghc.hs
- hadrian/src/Settings/Builders/Make.hs
- hadrian/src/Settings/Builders/RunTest.hs
- hadrian/src/Settings/Builders/SplitSections.hs
- hadrian/src/Settings/Default.hs
- hadrian/src/Settings/Flavours/Benchmark.hs
- hadrian/src/Settings/Flavours/Development.hs
- hadrian/src/Settings/Flavours/GhcInGhci.hs
- hadrian/src/Settings/Flavours/Performance.hs
- hadrian/src/Settings/Flavours/Quick.hs
- hadrian/src/Settings/Flavours/QuickCross.hs
- hadrian/src/Settings/Flavours/Quickest.hs
- hadrian/src/Settings/Flavours/Validate.hs
- hadrian/src/Settings/Packages.hs
- libraries/base/base.cabal.in
- libraries/base/changelog.md
- libraries/base/src/Control/Concurrent.hs
- libraries/base/src/Data/Array/Byte.hs
- libraries/base/src/GHC/Num.hs
- − libraries/base/src/GHC/Num/BigNat.hs
- − libraries/base/src/GHC/Num/Integer.hs
- − libraries/base/src/GHC/Num/Natural.hs
- libraries/base/src/System/CPUTime/Utils.hs
- + libraries/base/src/System/IO/OS.hs
- libraries/base/src/System/Timeout.hs
- libraries/base/tests/IO/all.T
- + libraries/base/tests/IO/osHandles001FileDescriptors.hs
- + libraries/base/tests/IO/osHandles001FileDescriptors.stdout
- + libraries/base/tests/IO/osHandles001WindowsHandles.hs
- + libraries/base/tests/IO/osHandles001WindowsHandles.stdout
- + libraries/base/tests/IO/osHandles002FileDescriptors.hs
- + libraries/base/tests/IO/osHandles002FileDescriptors.stderr
- + libraries/base/tests/IO/osHandles002FileDescriptors.stdin
- + libraries/base/tests/IO/osHandles002FileDescriptors.stdout
- + libraries/base/tests/IO/osHandles002WindowsHandles.hs
- + libraries/base/tests/IO/osHandles002WindowsHandles.stderr
- + libraries/base/tests/IO/osHandles002WindowsHandles.stdin
- + libraries/base/tests/IO/osHandles002WindowsHandles.stdout
- libraries/base/tests/T23454.stderr
- libraries/base/tests/perf/Makefile
- libraries/ghc-bignum/ghc-bignum.cabal
- libraries/ghc-compact/tests/all.T
- libraries/ghc-experimental/CHANGELOG.md
- libraries/ghc-experimental/ghc-experimental.cabal.in
- libraries/ghc-experimental/src/GHC/Exception/Backtrace/Experimental.hs
- libraries/ghc-experimental/src/GHC/TypeNats/Experimental.hs
- libraries/ghc-internal/ghc-internal.cabal.in
- libraries/ghc-internal/src/GHC/Internal/CString.hs
- libraries/ghc-internal/src/GHC/Internal/Classes.hs
- + libraries/ghc-internal/src/GHC/Internal/Classes/IP.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Data.hs
- libraries/ghc-internal/src/GHC/Internal/Err.hs
- libraries/ghc-internal/src/GHC/Internal/Exts.hs
- libraries/ghc-internal/src/GHC/Internal/Functor/ZipList.hs
- + libraries/ghc-internal/src/GHC/Internal/System/IO/OS.hs
- libraries/ghc-internal/tests/backtraces/all.T
- libraries/ghc-internal/tests/stack-annotation/all.T
- + libraries/ghc-internal/tests/stack-annotation/ann_frame005.hs
- + libraries/ghc-internal/tests/stack-annotation/ann_frame005.stdout
- libraries/ghci/GHCi/Server.hs
- libraries/haskeline
- llvm-targets
- rts/AllocArray.c
- rts/AllocArray.h
- rts/ClosureTable.c
- rts/Heap.c
- rts/PrimOps.cmm
- rts/RtsFlags.c
- rts/Threads.c
- rts/Trace.c
- rts/Weak.c
- rts/include/Cmm.h
- rts/include/rts/Flags.h
- rts/include/stg/Ticky.h
- rts/rts.cabal
- rts/sm/Evac.c
- rts/sm/Evac_thr.c → rts/sm/Evac_par.c
- rts/sm/Scav_thr.c → rts/sm/Scav_par.c
- rts/sm/Storage.c
- − rts/win32/libHSffi.def
- − rts/win32/libHSghc-internal.def
- − rts/win32/libHSghc-prim.def
- testsuite/driver/runtests.py
- testsuite/driver/testglobals.py
- testsuite/driver/testlib.py
- testsuite/driver/testutil.py
- + testsuite/tests/default/T25825.hs
- testsuite/tests/default/all.T
- testsuite/tests/deriving/should_fail/T1496.stderr
- testsuite/tests/deriving/should_fail/T4846.stderr
- testsuite/tests/deriving/should_fail/T5498.stderr
- testsuite/tests/deriving/should_fail/T6147.stderr
- testsuite/tests/deriving/should_fail/T7148.stderr
- testsuite/tests/deriving/should_fail/T7148a.stderr
- testsuite/tests/deriving/should_fail/T8984.stderr
- testsuite/tests/deriving/should_fail/deriving-via-fail.stderr
- testsuite/tests/deriving/should_fail/deriving-via-fail4.stderr
- testsuite/tests/deriving/should_fail/deriving-via-fail5.stderr
- testsuite/tests/driver/T16318/Makefile
- testsuite/tests/driver/T18125/Makefile
- testsuite/tests/gadt/CasePrune.stderr
- testsuite/tests/ghci.debugger/scripts/T8487.stdout
- testsuite/tests/ghci.debugger/scripts/break011.stdout
- testsuite/tests/ghci.debugger/scripts/break017.stdout
- testsuite/tests/ghci.debugger/scripts/break025.stdout
- testsuite/tests/indexed-types/should_fail/T9580.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/interface-stability/ghc-experimental-exports.stdout
- testsuite/tests/interface-stability/ghc-experimental-exports.stdout-mingw32
- testsuite/tests/interface-stability/ghc-prim-exports.stdout
- testsuite/tests/interface-stability/ghc-prim-exports.stdout-mingw32
- testsuite/tests/linear/should_fail/LinearRole.stderr
- testsuite/tests/numeric/should_compile/T19641.stderr
- testsuite/tests/perf/should_run/all.T
- testsuite/tests/roles/should_fail/RolesIArray.stderr
- testsuite/tests/rts/Makefile
- testsuite/tests/rts/all.T
- testsuite/tests/rts/ipe/all.T
- + testsuite/tests/simplCore/should_compile/T26548.hs
- + testsuite/tests/simplCore/should_compile/T26548.stderr
- testsuite/tests/simplCore/should_compile/T26615.stderr
- + testsuite/tests/simplCore/should_compile/T26805.hs
- + testsuite/tests/simplCore/should_compile/T26805.stderr
- testsuite/tests/simplCore/should_compile/all.T
- testsuite/tests/th/TH_implicitParams.stdout
- + testsuite/tests/typecheck/should_compile/T26737.hs
- + testsuite/tests/typecheck/should_compile/T26746.hs
- + testsuite/tests/typecheck/should_compile/T26805a.hs
- testsuite/tests/typecheck/should_compile/all.T
- testsuite/tests/typecheck/should_fail/T10285.stderr
- testsuite/tests/typecheck/should_fail/T10534.stderr
- testsuite/tests/typecheck/should_fail/T10715b.stderr
- testsuite/tests/typecheck/should_fail/T11347.stderr
- testsuite/tests/typecheck/should_fail/T15801.stderr
- + testsuite/tests/typecheck/should_fail/T15850.hs
- + testsuite/tests/typecheck/should_fail/T15850.stderr
- + testsuite/tests/typecheck/should_fail/T15850_Lib.hs
- + testsuite/tests/typecheck/should_fail/T20289.hs
- + testsuite/tests/typecheck/should_fail/T20289.stderr
- + testsuite/tests/typecheck/should_fail/T20289_A.hs
- testsuite/tests/typecheck/should_fail/T22645.stderr
- testsuite/tests/typecheck/should_fail/T22924a.stderr
- testsuite/tests/typecheck/should_fail/T22924b.stderr
- + testsuite/tests/typecheck/should_fail/T23731.hs
- + testsuite/tests/typecheck/should_fail/T23731.stderr
- + testsuite/tests/typecheck/should_fail/T23731b.hs
- + testsuite/tests/typecheck/should_fail/T23731b.stderr
- + testsuite/tests/typecheck/should_fail/T23731b_aux.hs
- + testsuite/tests/typecheck/should_fail/T25679.hs
- + testsuite/tests/typecheck/should_fail/T25679.stderr
- + testsuite/tests/typecheck/should_fail/T25949.hs
- + testsuite/tests/typecheck/should_fail/T25949.stderr
- + testsuite/tests/typecheck/should_fail/T25949_aux.hs
- + testsuite/tests/typecheck/should_fail/T26137.hs
- + testsuite/tests/typecheck/should_fail/T26137.stderr
- testsuite/tests/typecheck/should_fail/TcCoercibleFail.hs
- testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr
- testsuite/tests/typecheck/should_fail/TcCoercibleFail3.stderr
- testsuite/tests/typecheck/should_fail/all.T
- utils/ghc-toolchain/exe/Main.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/757166fb73ff462f930008dd01f072…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/757166fb73ff462f930008dd01f072…
You're receiving this email because of your account on gitlab.haskell.org.
1
0