Teo Camarasu pushed new branch wip/T26848 at Glasgow Haskell Compiler / GHC
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/T26848
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc] Deleted branch wip/jeltsch/ghc-desugar-removal
by Wolfgang Jeltsch (@jeltsch) 29 Jan '26
by Wolfgang Jeltsch (@jeltsch) 29 Jan '26
29 Jan '26
Wolfgang Jeltsch deleted branch wip/jeltsch/ghc-desugar-removal at Glasgow Haskell Compiler / GHC
--
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/T20264] 53 commits: base: don't expose GHC.Num.{BigNat, Integer, Natural}
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/T20264 at Glasgow Haskell Compiler / GHC
Commits:
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.
- - - - -
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`.
- - - - -
e8f5a45d by sterni at 2026-01-29T04:19:18-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>
- - - - -
729d49e7 by Joseph Fourment at 2026-01-29T14:14:39+00:00
Add type-lets into Core
The plan for #20264 is to introduce let-bound types to have observable sharing in types.
To avoid the need to carry an environment when dealing with occurrences of these type variables,
we embed the types they're bound to (if any) in a `tv_unfolding :: Maybe Type` attribute.
This way, one can look through let-bound type variables using `coreView` and friends.
In particular, definitional equality looks through unfoldings.
simple-opt: don't inline type-lets
specialise: fix type-lets in DFun unfoldings
During specialisation, a dictionary being specialised gets a new unfolding by turning
`DFun \ bndrs -> MkD @<T1> ... @<Tm> <op1> ... <opn>` into
`DFun \ spec_bndrs -> MkD @((\ bndrs -> TYPE: <T1>) spec_args) ... ((\ bndrs -> <opn>) spec_args)`
which in turns gets beta-reduced into
`DFun \ spec_bndrs -> MkD (let { bndrs = spec_args } in TYPE: <T1>) ... (let { bndrs = spec_args } in <opn>)`.
Previously, such let binders would immediately be substituted into the type so it didn't cause any issue,
but now we want to avoid inlining.
Arguments of the form `let { bndrs = spec_args } in TYPE: <T1>` are not considered as type arguments since they're
not of the canonical form `TYPE: something`.
This commit restores the previous behavior of substituting the specialised type arguments.
Alternatively, we could attach some floated type bindings to `DFun`s.
occur-anal: implement occurence analysis for type variables
In order to find out let-bound type variables that are used only once, in the hope of inlining them,
we need to track type variables as well in the occurrence analiser. Just like Id's, we attach an
`OccInfo` to each (immutable) type variable, and we walk into types and coercions to accurately gather
occurrences.
simplifier: don't inline type-lets
Keep propagating type-lets further down the pipeline, in the simplifier.
We also update CallArity, CprAnal, DmdAnal, WorkWrap, and Specialise to ignore type-lets.
prep: make type-lets pass through CorePrep
As a first attempt, ignore type-lets in CorePrep to avoid crashes.
However, this is not enough: CorePrep also does some let-floating.
If we don't float type-lets along with value-level let-bindings,
the latter can float out of the scope of a type variable in use.
simple-opt: fix simple_type_bind
Also:
- Inline small types using a new typeIsSmallEnoughToInline predicate
- Inline single-occurrence variables
simple-opt: make beta-reduction use simple_bind_type
iface: add IfaceTypeLetBndr to represent non-top-level type-let binders
IfaceLetBndr isn't fit to represent type-let binders, as it includes a
bunch of vacuous flags for Ids only.
Instead of putting squares in circles, I added a new constructor for type binders.
The downside is that it breaks existing iface files, so since we can't bootstrap
yet so we have to bootstrap a cherry-picked branch and then checkout again to build
with --freeze1.
To avoid similar issues in the future, IfaceTyVarInfoItem serialises with a tag
despite there being only one constructor for now.
dmd-anal: prefix unused variable with _ to avoid warning
type: inline unfoldView in sORTKind_maybe
tidy: deal with type-lets
notes: add Note [Type and coercion lets]
notes: update Note [Comparing nullary type synonyms] to account for type variables
While updating backlinks, I noticed the optimisation for type variables
could be performed in more places.
simplifier: inline single-occurring type-lets
cleanup: remove NOINLINE on tyVarOccInfo
Wibbles
Wibbles
Progress
Progress
More progress
Progress
...doesn't compile though
Mostly working now
Aggressively create type-lets
more progress
More progress
Temp debug printing
Remove bogus assert
Fix anoher couple of bugs
in SimpleOpt and exprIsTrivial
Improve zonking of foreign decls to avoid TcTyVars escaping
Wibbles
Some small wibbles
Improvements
Rmmove trace
Wibbles
Use lambda, not let, in WorkWrap
Using type let did not work right with type lets and shadowing
Requires Lint to be OK join points under beta redexes -- but it is!
Needs better documentation
Wibbles
More improvements
More improvements
* Less cloning in SpecConstr
* Lint checks RULES for imported binders
Comments only
Wibble
Wibbles
Wibbles
.. getting Lint errors when compiling GHC.Internal.Classes
Wibbles
More improvements
..now getting to the back end an interface file generation
Wibbles
Wibble unsed var
Missing case in tyThingEntityInfo
Add IfaceExtTyVar
Wibbles
Start to make OccAnal count TyCoVars properly [skip ci]
Proper occurrence analysis for TyCoVars
Wibble imports
Wibble imports again
Fix two tricky buglets
More small fixes
Add missing mkAbsCoreApps
...which caused bad Lint errors
More wibbles
More wibbles exp around mkPolyAbsLams
- - - - -
ddd2218d by Simon Peyton Jones at 2026-01-29T14:14:39+00:00
Make it compile again
- - - - -
7f7c8f36 by Simon Peyton Jones at 2026-01-29T14:14:39+00:00
Simplify mkcoreAbsLams a bit
..Needs documentation
- - - - -
abeabd7e by Simon Peyton Jones at 2026-01-29T14:14:39+00:00
Fix build
Several important fixes, need better docs
- - - - -
718939b0 by Simon Peyton Jones at 2026-01-29T14:14:39+00:00
Wibbles
- - - - -
16ef3280 by Simon Peyton Jones at 2026-01-29T14:14:39+00:00
Make it compile
- - - - -
532ca813 by Simon Peyton Jones at 2026-01-29T14:14:39+00:00
Improve Lint error message slightly
- - - - -
ed5963cd by Simon Peyton Jones at 2026-01-29T14:14:39+00:00
Wibble lint rules
- - - - -
2af5deec by Simon Peyton Jones at 2026-01-29T14:14:39+00:00
Wibbles
- - - - -
fdc5c34c by Simon Peyton Jones at 2026-01-29T14:14:39+00:00
Wibbles
- - - - -
279 changed files:
- .gitignore
- .gitlab-ci.yml
- .gitlab/ci.sh
- .gitlab/darwin/nix/sources.json
- .gitlab/darwin/toolchain.nix
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/CmmToAsm/PPC/CodeGen.hs
- compiler/GHC/Core.hs
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/Coercion/Axiom.hs
- compiler/GHC/Core/DataCon.hs
- compiler/GHC/Core/FVs.hs
- compiler/GHC/Core/FamInstEnv.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Make.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/CSE.hs
- compiler/GHC/Core/Opt/CallArity.hs
- compiler/GHC/Core/Opt/CprAnal.hs
- compiler/GHC/Core/Opt/DmdAnal.hs
- compiler/GHC/Core/Opt/Exitify.hs
- compiler/GHC/Core/Opt/FloatIn.hs
- compiler/GHC/Core/Opt/OccurAnal.hs
- compiler/GHC/Core/Opt/SetLevels.hs
- compiler/GHC/Core/Opt/Simplify.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/Simplify/Utils.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/Predicate.hs
- compiler/GHC/Core/Rules.hs
- compiler/GHC/Core/Seq.hs
- compiler/GHC/Core/SimpleOpt.hs
- compiler/GHC/Core/Subst.hs
- compiler/GHC/Core/Tidy.hs
- compiler/GHC/Core/TyCo/Compare.hs
- compiler/GHC/Core/TyCo/FVs.hs
- compiler/GHC/Core/TyCo/Ppr.hs
- compiler/GHC/Core/TyCo/Ppr.hs-boot
- 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/Type.hs
- compiler/GHC/Core/Unfold/Make.hs
- compiler/GHC/Core/Unify.hs
- compiler/GHC/Core/Utils.hs
- compiler/GHC/CoreToIface.hs
- compiler/GHC/CoreToStg.hs
- compiler/GHC/CoreToStg/Prep.hs
- compiler/GHC/Data/Maybe.hs
- compiler/GHC/Driver/Config/Core/Lint.hs
- compiler/GHC/Driver/DynFlags.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/HsToCore/Binds.hs
- compiler/GHC/HsToCore/Monad.hs
- compiler/GHC/HsToCore/Pmc/Solver.hs
- compiler/GHC/HsToCore/Pmc/Utils.hs
- compiler/GHC/Iface/Decl.hs
- compiler/GHC/Iface/Ext/Types.hs
- compiler/GHC/Iface/Ext/Utils.hs
- compiler/GHC/Iface/Rename.hs
- compiler/GHC/Iface/Syntax.hs
- compiler/GHC/Iface/Tidy.hs
- compiler/GHC/Iface/Type.hs
- compiler/GHC/IfaceToCore.hs
- compiler/GHC/Rename/Unbound.hs
- compiler/GHC/Tc/Deriv.hs
- compiler/GHC/Tc/Deriv/Infer.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/HsType.hs
- compiler/GHC/Tc/Gen/Pat.hs
- compiler/GHC/Tc/Gen/Splice.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/Rewrite.hs
- compiler/GHC/Tc/Solver/Solve.hs
- compiler/GHC/Tc/TyCl.hs
- compiler/GHC/Tc/TyCl/Instance.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/Unify.hs
- compiler/GHC/Tc/Zonk/TcType.hs
- compiler/GHC/Tc/Zonk/Type.hs
- compiler/GHC/Types/Basic.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/TyThing.hs
- compiler/GHC/Types/TypeEnv.hs
- compiler/GHC/Types/Var.hs
- compiler/GHC/Unit/State.hs
- compiler/GHC/Utils/Monad.hs
- compiler/GHC/Utils/Outputable.hs
- compiler/GHC/Utils/Trace.hs
- compiler/Language/Haskell/Syntax/Decls.hs
- compiler/ghc.cabal.in
- docs/users_guide/9.16.1-notes.rst
- docs/users_guide/exts/roles.rst
- docs/users_guide/index.rst
- docs/users_guide/rtd-theme/layout.html
- docs/users_guide/runtime_control.rst
- 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/Default.hs
- hadrian/src/Settings/Flavours/GhcInGhci.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/Desugar.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/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
- 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
- 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/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/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/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
- utils/ghc-toolchain/exe/Main.hs
- utils/haddock/haddock-api/src/Haddock/Convert.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f4f35f6957370e961805ae61e74c00…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f4f35f6957370e961805ae61e74c00…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
Simon Peyton Jones pushed to branch wip/T24464 at Glasgow Haskell Compiler / GHC
Commits:
1a6aff80 by Simon Peyton Jones at 2026-01-29T13:50:26+00:00
Wibble errs
- - - - -
4 changed files:
- testsuite/tests/codeGen/should_run/CgStaticPointersNoFullLazyness.hs
- testsuite/tests/ghci/scripts/T20150.stdout
- testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
- testsuite/tests/parser/should_compile/T14189.stderr
Changes:
=====================================
testsuite/tests/codeGen/should_run/CgStaticPointersNoFullLazyness.hs
=====================================
@@ -15,9 +15,9 @@ main = do
print $ deRefStaticPtr (static g)
print $ deRefStaticPtr p0 'a'
print $ deRefStaticPtr (static t_field) $ T 'b'
- where
- g :: String
- g = "found"
+
+g :: String
+g = "found"
lookupKey :: StaticPtr a -> IO a
lookupKey p = unsafeLookupStaticPtr (staticKey p) >>= \case
=====================================
testsuite/tests/ghci/scripts/T20150.stdout
=====================================
@@ -2,5 +2,3 @@ Collecting type info for 1 module(s) ...
T20150.hs:(7,1)-(7,3): GHC.Internal.StaticPtr.StaticPtr GHC.Internal.Types.Int
T20150.hs:(7,14)-(7,14): GHC.Internal.Types.Int
T20150.hs:(7,7)-(7,14): GHC.Internal.StaticPtr.StaticPtr GHC.Internal.Types.Int
-T20150.hs:(7,7)-(7,14): GHC.Internal.StaticPtr.StaticPtr GHC.Internal.Types.Int -> GHC.Internal.StaticPtr.StaticPtr GHC.Internal.Types.Int
-T20150.hs:(7,7)-(7,14): GHC.Internal.StaticPtr.StaticPtr GHC.Internal.Types.Int
=====================================
testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
=====================================
@@ -6,7 +6,7 @@
(HsGroup
(NoExtField)
(XValBindsLR
- (NValBinds
+ (HsVBG
[((,)
(NonRecursive)
[(L
=====================================
testsuite/tests/parser/should_compile/T14189.stderr
=====================================
@@ -6,7 +6,7 @@
(HsGroup
(NoExtField)
(XValBindsLR
- (NValBinds
+ (HsVBG
[]
[]))
[]
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1a6aff80251aeb5d31c46ad62d5b9bf…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1a6aff80251aeb5d31c46ad62d5b9bf…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
29 Jan '26
Teo Camarasu pushed to branch wip/T26834 at Glasgow Haskell Compiler / GHC
Commits:
2af36711 by Teo Camarasu at 2026-01-29T13:06:59+00:00
Split out GHC.Internal.Data.Ord.Down
- - - - -
13 changed files:
- libraries/base/src/Data/Foldable1.hs
- libraries/base/src/Data/Functor/Classes.hs
- libraries/base/src/Data/Ord.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/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/base/src/Data/Foldable1.hs
=====================================
@@ -45,7 +45,7 @@ import Data.Complex (Complex (..))
import GHC.Generics
(M1 (..), Par1 (..), Rec1 (..), V1, (:*:) (..), (:+:) (..), (:.:) (..))
-import GHC.Internal.Data.Ord (Down (..))
+import GHC.Internal.Data.Ord.Down (Down (..))
import qualified GHC.Internal.Data.Monoid as Mon
=====================================
libraries/base/src/Data/Functor/Classes.hs
=====================================
@@ -76,7 +76,7 @@ import Control.Applicative (Alternative((<|>)), Const(Const))
import GHC.Internal.Data.Functor.Identity (Identity(Identity))
import GHC.Internal.Data.Proxy (Proxy(Proxy))
import Data.List.NonEmpty (NonEmpty(..))
-import GHC.Internal.Data.Ord (Down(Down))
+import GHC.Internal.Data.Ord.Down (Down(Down))
import Data.Complex (Complex((:+)))
import GHC.Generics (Generic1(..), Generically1(..), V1, U1(..), Par1(..), Rec1(..), K1(..), M1(..) , (:+:)(..), (:*:)(..), (:.:)(..), URec(..), UAddr, UChar, UDouble, UFloat, UInt, UWord)
=====================================
libraries/base/src/Data/Ord.hs
=====================================
@@ -21,4 +21,5 @@ module Data.Ord
clamp
) where
-import GHC.Internal.Data.Ord
\ No newline at end of file
+import GHC.Internal.Data.Ord
+import GHC.Internal.Data.Ord.Down
=====================================
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/2af36711d6167174c151c6a311ba0df…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2af36711d6167174c151c6a311ba0df…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/T26772] 14 commits: ci: update darwin boot ghc to 9.10.3
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/T26772 at Glasgow Haskell Compiler / GHC
Commits:
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.
- - - - -
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`.
- - - - -
e8f5a45d by sterni at 2026-01-29T04:19:18-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>
- - - - -
390c794d by Simon Peyton Jones at 2026-01-29T12:59:58+00:00
Fix subtle bug in GHC.Core.Utils.mkTick
This patch fixes a decade-old bug in `mkTick`, which
could generate type-incorrect code! See the diagnosis
in #26772.
The new code is simpler and easier to understand.
(As #26772 says, I think it could be improved further.)
- - - - -
2cef712f by Simon Peyton Jones at 2026-01-29T13:02:49+00:00
Modify a debug-trace in the Simplifier
...just to show a bit more information.
- - - - -
ed30e6b8 by Simon Peyton Jones at 2026-01-29T13:04:00+00:00
Fix long-standing interaction between ticks and casts
The code for Note [Eliminate Identity Cases] was simply wrong when
ticks and casts interacted. This patch fixes the interaction.
It was shown up when validating #26772, although it's not the exactly
the bug that's reported by #26772. Nor is it easy to reproduce, hence
no regression test.
- - - - -
120 changed files:
- .gitlab-ci.yml
- .gitlab/ci.sh
- .gitlab/darwin/nix/sources.json
- .gitlab/darwin/toolchain.nix
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/FamInstEnv.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/Simplify/Utils.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/Core/Utils.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/Class.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/changelog.md
- − libraries/base/src/GHC/Desugar.hs
- libraries/base/tests/T23454.stderr
- 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/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/gadt/CasePrune.stderr
- testsuite/tests/ghci.debugger/scripts/T26042b.stdout
- testsuite/tests/ghci.debugger/scripts/T26042c.stdout
- testsuite/tests/ghci.debugger/scripts/T26042d2.stdout
- 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/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/575a61a9c3e8c67f0ef8e8c57646fc…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/575a61a9c3e8c67f0ef8e8c57646fc…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/andreask/linker_fix] more debug wibbles
by Andreas Klebinger (@AndreasK) 29 Jan '26
by Andreas Klebinger (@AndreasK) 29 Jan '26
29 Jan '26
Andreas Klebinger pushed to branch wip/andreask/linker_fix at Glasgow Haskell Compiler / GHC
Commits:
d49cb21a by Andreas Klebinger at 2026-01-29T13:38:53+01:00
more debug wibbles
- - - - -
2 changed files:
- rts/linker/LoadArchive.c
- rts/linker/MachO.c
Changes:
=====================================
rts/linker/LoadArchive.c
=====================================
@@ -574,6 +574,7 @@ HsInt loadArchive_ (pathchar *path)
#endif
)
{
+ ASSERT(!isGnuIndex);
DEBUG_LOG("Member might be an object file...loading...\n");
#if defined(darwin_HOST_OS) || defined(ios_HOST_OS)
if (RTS_LINKER_USE_MMAP)
@@ -635,6 +636,7 @@ HsInt loadArchive_ (pathchar *path)
if (0 == loadOc(oc)) {
errorBelch("Failed to load OC %" PATH_FMT " , aborting.\n", path);
stgFree(fileName);
+ freeObjectCode( oc );
fclose(f);
return 0;
} else {
=====================================
rts/linker/MachO.c
=====================================
@@ -1772,7 +1772,7 @@ machoGetMisalignment( FILE * f, int* misalignment_out )
fseek(f, -sizeof(header), SEEK_CUR);
if(header.magic != MH_MAGIC_64) {
- debugBelch("Bad magic. Expected: %08x, got: %08x.",
+ errorBelch("Bad magic. Expected: %08x, got: %08x.",
MH_MAGIC_64, header.magic);
return 0;
}
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d49cb21aaebac390ddbcb686c9d801e…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d49cb21aaebac390ddbcb686c9d801e…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
Simon Peyton Jones pushed new branch wip/T26826 at Glasgow Haskell Compiler / GHC
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/T26826
You're receiving this email because of your account on gitlab.haskell.org.
1
0
29 Jan '26
Andreas Klebinger pushed to branch wip/andreask/linker_fix at Glasgow Haskell Compiler / GHC
Commits:
2c39a9a3 by Andreas Klebinger at 2026-01-29T13:32:00+01:00
debug wibbles
- - - - -
4 changed files:
- rts/Linker.c
- rts/linker/LoadArchive.c
- rts/linker/MachO.c
- rts/linker/PEi386.c
Changes:
=====================================
rts/Linker.c
=====================================
@@ -1415,7 +1415,7 @@ preloadObjectFile (pathchar *path)
// We calculate the correct alignment from the header before
// reading the file, and then we misalign image on purpose so
// that the actual sections end up aligned again.
- machoGetMisalignment(f, &misalignment);
+ int valid_macho = machoGetMisalignment(f, &misalignment);
//machoGetMisalignment might fail to parse the header, but in that
//case so will verifyAndInitOc so we leave cleanup to after verifyAndInitOc.
image = stgMallocBytes(fileSize + misalignment, "loadObj(image)");
@@ -1504,7 +1504,7 @@ HsInt loadObj (pathchar *path)
return r;
}
-// Call the relevant VeriffyImage_* and ocInit_* functions.
+// Call the relevant VerifyImage_* and ocInit_* functions.
// Return 1 on success.
HsInt verifyAndInitOc (ObjectCode* oc)
{
=====================================
rts/linker/LoadArchive.c
=====================================
@@ -26,6 +26,7 @@
#include <ctype.h>
#include <sys/types.h>
#include <fs_rts.h>
+#include <stdio.h>
#define FAIL(...) do {\
errorBelch("loadArchive: "__VA_ARGS__); \
@@ -33,6 +34,7 @@
} while (0)
#define DEBUG_LOG(...) IF_DEBUG(linker, debugBelch("loadArchive: " __VA_ARGS__))
+#define DEBUG_LOG_ALWAYS(...) (fprintf(stderr, "loadArchive: " __VA_ARGS__))
#if defined(darwin_HOST_OS) || defined(ios_HOST_OS)
@@ -344,7 +346,7 @@ HsInt loadArchive_ (pathchar *path)
Ignore requests to load multiple times */
if (isAlreadyLoaded(path)) {
IF_DEBUG(linker,
- debugBelch("ignoring repeated load of %" PATH_FMT "\n", path));
+ DEBUG_LOG("ignoring repeated load of %" PATH_FMT "\n", path));
return 1; /* success */
}
@@ -365,6 +367,7 @@ HsInt loadArchive_ (pathchar *path)
bool isThin = archive_fmt == ThinArchive;
if(isThin) {
DEBUG_LOG("Found thin archive.\n");
+ DEBUG_LOG_ALWAYS("Found thin archive.\n");
}
DEBUG_LOG("loading archive contents\n");
@@ -630,6 +633,7 @@ HsInt loadArchive_ (pathchar *path)
if (0 == loadOc(oc)) {
+ errorBelch("Failed to load OC %" PATH_FMT " , aborting.\n", path);
stgFree(fileName);
fclose(f);
return 0;
=====================================
rts/linker/MachO.c
=====================================
@@ -175,7 +175,7 @@ resolveImports(
int
ocAllocateExtras_MachO(ObjectCode* oc)
{
- IF_DEBUG(linker, debugBelch("ocAllocateExtras_MachO: start\n"));
+ IF_DEBUG(linker, DEBUG_LOG_ALWAYS("ocAllocateExtras_MachO: start\n"));
if (NULL != oc->info->symCmd) {
IF_DEBUG(linker,
@@ -200,6 +200,10 @@ int
ocVerifyImage_MachO(ObjectCode * oc)
{
char *image = (char*) oc->image;
+ if (oc->fileSize < sizeof(MachOHeader)) {
+ errorBelch("Tried loading machO smaller than header size.\n");
+ return 0;
+ }
MachOHeader *header = (MachOHeader*) image;
IF_DEBUG(linker, debugBelch("ocVerifyImage_MachO: start\n"));
=====================================
rts/linker/PEi386.c
=====================================
@@ -475,7 +475,7 @@ static void addDLLHandle(
static bool verifyCOFFHeader(
uint16_t machine,
- IMAGE_FILE_HEADER *hdr
+ IMAGE_FILE_HEADER *hdr,
pathchar *fileName);
static bool checkIfDllLoaded(
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2c39a9a3c98b958e0d4f2da917e1067…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2c39a9a3c98b958e0d4f2da917e1067…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/T26834] 3 commits: ghc-internal: refine List imports
by Teo Camarasu (@teo) 29 Jan '26
by Teo Camarasu (@teo) 29 Jan '26
29 Jan '26
Teo Camarasu pushed to branch wip/T26834 at Glasgow Haskell Compiler / GHC
Commits:
1abfa580 by Teo Camarasu at 2026-01-29T11:14:21+00:00
ghc-internal: refine List imports
- - - - -
d2c0db71 by Teo Camarasu at 2026-01-29T11:14:21+00:00
Move MonadFix Identity into Monad.Fix
- - - - -
c7d4cf5e by Teo Camarasu at 2026-01-29T11:14:21+00:00
Split out GHC.Internal.Data.Ord.Down
- - - - -
23 changed files:
- libraries/base/src/Data/Ord.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/Functor/Identity.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/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/Exts.hs
- 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
Changes:
=====================================
libraries/base/src/Data/Ord.hs
=====================================
@@ -21,4 +21,5 @@ module Data.Ord
clamp
) where
-import GHC.Internal.Data.Ord
\ No newline at end of file
+import GHC.Internal.Data.Ord
+import GHC.Internal.Data.Ord.Down
=====================================
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,13 +33,13 @@ 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
import GHC.Internal.List ( head, drop )
import GHC.Internal.Control.Monad.ST.Imp
import GHC.Internal.System.IO
+import GHC.Internal.Data.Functor.Identity (Identity(..))
-- | Monads having fixed points with a \'knot-tying\' semantics.
-- Instances of 'MonadFix' should satisfy the following laws:
@@ -166,8 +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,12 +23,11 @@ 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
import qualified GHC.Internal.Data.List.NonEmpty as NE
-import qualified GHC.Internal.Data.List as List
+import qualified GHC.Internal.List as List
import GHC.Internal.Data.Maybe
import GHC.Internal.Data.Tuple
--import Prelude
@@ -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,8 +116,8 @@ 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.List (findIndex)
+import GHC.Internal.Data.Ord.Down
+import GHC.Internal.Data.OldList (findIndex)
import GHC.Internal.Data.Typeable
import GHC.Internal.Data.Version( Version(..) )
import GHC.Internal.Base hiding (Any, IntRep, FloatRep, NonEmpty(..))
=====================================
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/Functor/Identity.hs
=====================================
@@ -33,7 +33,6 @@ module GHC.Internal.Data.Functor.Identity (
Identity(..),
) where
-import GHC.Internal.Control.Monad.Fix
import GHC.Internal.Data.Bits (Bits, FiniteBits)
import GHC.Internal.Data.Coerce
import GHC.Internal.Data.Foldable
@@ -143,7 +142,3 @@ instance Applicative Identity where
-- | @since base-4.8.0.0
instance Monad Identity where
m >>= k = k (runIdentity m)
-
--- | @since base-4.8.0.0
-instance MonadFix Identity where
- mfix f = Identity (fix (runIdentity . f))
=====================================
libraries/ghc-internal/src/GHC/Internal/Data/List/NonEmpty.hs
=====================================
@@ -8,7 +8,7 @@ module GHC.Internal.Data.List.NonEmpty
) where
import GHC.Internal.Data.NonEmpty (NonEmpty (..), map)
-import qualified GHC.Internal.Data.List as List
+import qualified GHC.Internal.List as List
-- | The 'zip' function takes two streams and returns a stream of
-- corresponding pairs.
=====================================
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/String.hs
=====================================
@@ -35,7 +35,7 @@ module GHC.Internal.Data.String (
import GHC.Internal.Base
import GHC.Internal.Data.Functor.Const (Const (Const))
import GHC.Internal.Data.Functor.Identity (Identity (Identity))
-import GHC.Internal.Data.List (lines, words, unlines, unwords)
+import GHC.Internal.Data.OldList (lines, words, unlines, unwords)
-- | `IsString` is used in combination with the @-XOverloadedStrings@
-- language extension to convert the literals to different string types.
=====================================
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/Data/Version.hs
=====================================
@@ -40,7 +40,7 @@ import GHC.Internal.Data.Functor ( Functor(..) )
import GHC.Internal.Data.Bool ( (&&) )
import GHC.Internal.Data.Eq
import GHC.Internal.Int ( Int )
-import GHC.Internal.Data.List ( map, sort, concat, concatMap, intersperse, (++) )
+import GHC.Internal.Data.OldList ( map, sort, concat, concatMap, intersperse, (++) )
import GHC.Internal.Data.Ord
import GHC.Internal.Data.String ( String )
import GHC.Internal.Base ( Applicative(..) )
=====================================
libraries/ghc-internal/src/GHC/Internal/Event/Windows.hsc
=====================================
@@ -103,7 +103,7 @@ import GHC.Internal.IORef
import GHC.Internal.Maybe
import GHC.Internal.Ptr
import GHC.Internal.Word
-import GHC.Internal.Data.OldList (deleteBy)
+import GHC.Internal.List (deleteBy)
import qualified GHC.Internal.Event.Array as A
import GHC.Internal.Base
import GHC.Internal.Conc.Bound
=====================================
libraries/ghc-internal/src/GHC/Internal/ExecutionStack/Internal.hsc
=====================================
@@ -39,7 +39,7 @@ module GHC.Internal.ExecutionStack.Internal (
import GHC.Internal.Data.Functor
import GHC.Internal.Data.Maybe
-import GHC.Internal.Data.List (reverse, null)
+import GHC.Internal.List (reverse, null)
import GHC.Internal.Word
import GHC.Internal.Foreign.C.Types
import GHC.Internal.Foreign.C.String (peekCString, CString)
=====================================
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
--------------------------------------------------------------------------------
=====================================
libraries/ghc-internal/src/GHC/Internal/IO/Encoding/CodePage.hs
=====================================
@@ -30,7 +30,7 @@ import GHC.Internal.IO.Encoding.Types
import GHC.Internal.IO.Buffer
import GHC.Internal.Data.Bits
import GHC.Internal.Data.Maybe
-import GHC.Internal.Data.OldList (lookup)
+import GHC.Internal.List (lookup)
import qualified GHC.Internal.IO.Encoding.CodePage.API as API
import GHC.Internal.IO.Encoding.CodePage.Table
=====================================
libraries/ghc-internal/src/GHC/Internal/ResponseFile.hs
=====================================
@@ -28,7 +28,7 @@ import GHC.Internal.Control.Exception
import GHC.Internal.Data.Foldable (Foldable(..))
import GHC.Internal.Base
import GHC.Internal.Unicode (isSpace)
-import GHC.Internal.Data.List (filter, unlines, concat, reverse)
+import GHC.Internal.Data.OldList (filter, unlines, concat, reverse)
import GHC.Internal.Text.Show (show)
import GHC.Internal.System.Environment (getArgs)
import GHC.Internal.System.Exit (exitFailure)
=====================================
libraries/ghc-internal/src/GHC/Internal/Stack/Decode.hs
=====================================
@@ -36,7 +36,7 @@ import GHC.Internal.Num
import GHC.Internal.Data.Bits
import GHC.Internal.Data.Functor
import GHC.Internal.Data.Maybe (catMaybes)
-import GHC.Internal.Data.List
+import GHC.Internal.List
import GHC.Internal.Data.Tuple
import GHC.Internal.Foreign.Ptr
import GHC.Internal.Foreign.Storable
=====================================
libraries/ghc-internal/src/GHC/Internal/System/Environment/Blank.hsc
=====================================
@@ -40,14 +40,14 @@ module GHC.Internal.System.Environment.Blank
) where
import GHC.Internal.Data.Functor
-import GHC.Internal.Data.List (elem, null, takeWhile)
+import GHC.Internal.List (elem, null, takeWhile)
import GHC.Internal.Foreign.C.String
import GHC.Internal.Base
#if defined(mingw32_HOST_OS)
import GHC.Internal.Foreign.Ptr
import GHC.Internal.Windows
import GHC.Internal.Control.Monad
-import GHC.Internal.Data.List (lookup)
+import GHC.Internal.List (lookup)
#else
import GHC.Internal.Foreign.C.Error
import GHC.Internal.Foreign.C.Types
=====================================
libraries/ghc-internal/src/GHC/Internal/System/Environment/ExecutablePath.hsc
=====================================
@@ -53,7 +53,7 @@ import GHC.Internal.System.IO.Error (isDoesNotExistError)
import GHC.Internal.System.Posix.Internals
#elif defined(linux_HOST_OS) || defined(gnu_HOST_OS)
import GHC.Internal.Data.Functor
-import GHC.Internal.Data.List (isSuffixOf)
+import GHC.Internal.Data.OldList (isSuffixOf)
import GHC.Internal.Foreign.C.Types
import GHC.Internal.Foreign.C.Error
import GHC.Internal.Foreign.C.String
@@ -85,7 +85,7 @@ import GHC.Internal.System.Posix.Internals
import GHC.Internal.Control.Exception
import GHC.Internal.Control.Monad.Fail
import GHC.Internal.Data.Functor
-import GHC.Internal.Data.List (isPrefixOf, drop)
+import GHC.Internal.Data.OldList (isPrefixOf, drop)
import GHC.Internal.Word
import GHC.Internal.Foreign.C.String
import GHC.Internal.Foreign.Marshal.Array
=====================================
libraries/ghc-internal/src/GHC/Internal/System/Posix/Internals.hs
=====================================
@@ -70,7 +70,7 @@ import GHC.Internal.Foreign.Storable
import qualified GHC.Internal.Foreign.C.String.Encoding as GHC
#else
import GHC.Internal.Int
-import GHC.Internal.Data.OldList (elem)
+import GHC.Internal.List (elem)
#endif
-- ---------------------------------------------------------------------------
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c7cab14210c2578d36933856b158f6…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c7cab14210c2578d36933856b158f6…
You're receiving this email because of your account on gitlab.haskell.org.
1
0