[Git][ghc/ghc][wip/romes/25636] 105 commits: Don't build GHC with -Wcompat
by Rodrigo Mesquita (@alt-romes) 24 Feb '26
by Rodrigo Mesquita (@alt-romes) 24 Feb '26
24 Feb '26
Rodrigo Mesquita pushed to branch wip/romes/25636 at Glasgow Haskell Compiler / GHC
Commits:
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>
- - - - -
ce2d62fb by Jessica Clarke at 2026-01-29T19:48:51-05:00
PPC NCG: Use libcall for 64-bit cmpxchg on 32-bit PowerPC
There is no native instruction for this, and even if there were a
register pair version we could use, the implementation here is assuming
the values fit in a single register, and we end up only using / defining
the low halves of the registers.
Fixes: b4d39adbb5 ("PrimOps: Add CAS op for all int sizes")
Fixes: #23969
- - - - -
43d97761 by Michael Karcher at 2026-01-29T19:49:43-05:00
NCG for PPC: add pattern for CmmRegOff to iselExpr64
Closes #26828
- - - - -
aeeb4a20 by Matthew Pickering at 2026-01-30T11:42:47-05:00
determinism: Use deterministic map for Strings in TyLitMap
When generating typeable evidence the types we need evidence for all
cached in a TypeMap, the order terms are retrieved from a type map
determines the order the bindings appear in the program.
A TypeMap is quite diligent to use deterministic maps, apart from in the
TyLitMap, which uses a UniqFM for storing strings, whose ordering
depends on the Unique of the FastString.
This can cause non-deterministic .hi and .o files.
An unexpected side-effect is the error message but RecordDotSyntaxFail8
changing. I looked into this with Sam and this change caused the
constraints to be solved in a different order which results in a
slightly different error message. I have accepted the new test, since
the output before was non-deterministic and the new output is consistent
with the other messages in that file.
Fixes #26846
- - - - -
9e4d70c2 by Andrew Lelechenko at 2026-01-30T11:43:29-05:00
Upgrade text submodule to 2.1.4
- - - - -
631fa5ae by Recursion Ninja at 2026-01-31T22:30:11+00:00
Decouple `L.S.H.Decls` from importing `GHC.Types.Basic`
Data-types within `GHC.Types.Basic` which describe components of
the AST are migrated to `Language.Haskell.Syntax.Basic`. Related
function definitions are also moved.
Types moved to L.H.S. because they are part of the AST:
* TopLevelFlag
* RuleName
Types moved from L.H.S. to GHC.Hs. because they are not needed in the AST:
* TyConFlavour
* TypeOrData
* NewOrData
Migrated instances:
* `Outputable` instances moved to in `GHC.Utils.Outputable`
* `Binary` instance of `Boxity` moved to to `GHC.Utils.Binary`
* Other `Binary` instances are orphans to be migrated later.
The `OverlapMode` data-type is given a TTG extension point.
The `OverlapFlag` data-type, which depends on `OverlapMode`,
is updated to support `OverlapMode` with a GHC "pass" type paramerter.
In order to avoid module import cycles, `OverlapMode` and `OverlapFlag`
are migrated to new modules (no way around this).
* Migrated `OverlapMode` to new module `Language.Haskell.Syntax.Overlap`
* Migrated `OverlapFlag` to new module `GHC.Hs.Decls.Overlap`
- - - - -
9769cc03 by Simon Hengel at 2026-02-01T04:21:03-05:00
Update the documentation for MultiWayIf (fixes #25376)
(so that it matches the implementation)
- - - - -
5fc9442a by Peter Trommler at 2026-02-01T04:21:44-05:00
hadrian: Fix dependency generation for assembler
Assembler files allow # for comments unless in column 1. A modern
cpp for C treats those a preprocessor directives. We tell gcc that
a .S file is assembler with cpp and not C.
Fixes #26819
- - - - -
269c4087 by Simon Peyton Jones at 2026-02-01T19:38:10-05:00
Include current phase in the range for rule/unfoldings
This MR fixes a bad loop in the compiler: #26826.
The fix is to add (WAR2) to
Note [What is active in the RHS of a RULE or unfolding?]
in GHC.Core.Opt.Simplify.Utils
- - - - -
ddf1434f by Vladislav Zavialov at 2026-02-01T19:38:52-05:00
Refactor: merge HsMultilineString into HsString (#26860)
Before this patch, HsLit defined two separate constructors to represent
single-line and multi-line strings:
data HsLit x
...
| HsString (XHsString x) FastString
| HsMultilineString (XHsMultilineString x) FastString
I found this to be an unnecessary complication and an obstacle to unifying
HsLit with HsTyLit. Now we use HsString for both kinds of literals.
One user-facing change here is `ppr (HsString st s)` behaving differently for
single-line strings containing newlines:
x = "first line \
\asdf\n\
\second line"
Previously, the literal was fed to `ftext` with its newlines, producing an
ill-formed SDoc. This issue is now addressed by using `split` for both
single-line and multi-line strings:
vcat $ map text $ split '\n' (unpackFS src)
See the parser/should_fail/T26860ppr test.
In addition (and unrelatedly to the main payload of this patch),
drop the unused pmPprHsLit helper.
- - - - -
2b4f463c by Simon Peyton Jones at 2026-02-02T17:32:32+00:00
Remove exprIsCheap from doFloatFromRhs
See #26854 and Note [Float when expandable]
This patch simplifies the code, by removing an extra unnecessary test.
- - - - -
9db7f21f by Brandon Chinn at 2026-02-03T09:15:10-05:00
Refactor: make function patterns exhaustive
Also added missing (==) logic for:
* HsMultilineString
* HsInt{8,16,32}
* HsWord{8,16,32}
- - - - -
aa9c5e2c by Hécate Kleidukos at 2026-02-03T15:58:35-05:00
driver: Hide source paths at verbosity level 1 by default
- - - - -
c64cca1e by mangoiv at 2026-02-03T15:59:29-05:00
ExplicitLevelImports: check staging for types just like for values
Previously, imported types were entirely exempted from staging checks as
the implicit stage persistance assumed to be all imported types to be
well staged. ExplicitLevelImports' change specification, however, does
not do such an exemption. Thus we want to introduce such a check, just
like we have for values.
ExplicitLevelImports does not, however, talk about local names - from
its perspective, we could theoretically keep treating locally introduced
types specially - e.g. an ill-staged used in a quote would only emit a
warning, not an error. To allow for a potential future migration away
from such wrinkles as the staging check in notFound
(see Note [Out of scope might be a staging error]) we consistently do
the strict staging check that we also do for value if ExplicitLevelImports
is on.
Closes #26098
- - - - -
5f0dbeb6 by Simon Hengel at 2026-02-03T16:00:12-05:00
Use Haddock formatting in deprecation message of `initNameCache`
- - - - -
01ecb612 by Andreas Klebinger at 2026-02-04T09:56:25-05:00
testsuite: Explicitly use utf-8 encoding in rts-includes linter.
Not doing so caused failures on windows, as python failed to pick a
reasonable encoding even with locale set.
Fixes #26850
- - - - -
ea0d1317 by Zubin Duggal at 2026-02-04T09:57:06-05:00
Bump transformers submodule to 0.6.3.0
Fixes #26790
- - - - -
cbe4300e by Simon Peyton Jones at 2026-02-05T04:31:04-05: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.)
- - - - -
a193a8da by Simon Peyton Jones at 2026-02-05T04:31:04-05:00
Modify a debug-trace in the Simplifier
...just to show a bit more information.
- - - - -
b579dfdc by Simon Peyton Jones at 2026-02-05T04:31:04-05: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.
- - - - -
fac0de1e by Cheng Shao at 2026-02-05T04:31:49-05:00
libraries: bump Cabal submodule to 3.16.1.0
- - - - -
00589122 by Cheng Shao at 2026-02-05T04:31:49-05:00
libraries: bump deepseq submodule to 1.5.2.0
Also:
- Get rid of usage of deprecated `NFData` function instance in the
compiler
- `T21391` still relies on `NFData` function instance, add
`-Wno-deprecations` for the time being.
- - - - -
84474c71 by Cheng Shao at 2026-02-05T04:31:50-05:00
libraries: bump directory submodule to 1.3.10.1
- - - - -
1a9f4662 by Cheng Shao at 2026-02-05T04:31:50-05:00
libraries: bump exceptions submodule to 0.10.12
- - - - -
2e39a340 by Peng Fan at 2026-02-07T03:42:01-05:00
NCG/LA64: adjust register usage to avoid src-register being clobbered
- - - - -
9faf1b35 by Teo Camarasu at 2026-02-07T03:42:43-05:00
ghc-internal: Delete unnecessary GHC.Internal.Data.Ix
This module merely re-exports GHC.Internal.Ix. It was copied from
`base` when `ghc-internal` was split, but there is no reason to have
this now. So, let's delete it.
Resolves #26848
- - - - -
d112b440 by Sven Tennie at 2026-02-07T10:47:56-05:00
Add cabal.project file to generate-ci
This fixes the HLS setup for our CI code generation script
(generate-ci).
The project file simply makes `generate-ci` of the cabal file
discoverable.
- - - - -
5339f6f0 by Andreas Klebinger at 2026-02-07T10:48:40-05:00
CI: Don't collapse test results.
This puts test output back into the primary test log instead of a
subsection removing the need to expand a section to see test results.
While the intention was good in practice the old behaviour mostly wastes time
by requiring expansion of the section.
Fixes #26882
- - - - -
0e1cd2e0 by Evan Piro at 2026-02-08T10:35:16-08:00
Linker.MacOS reduce dynflags import
- - - - -
1c79a4cd by Michael Alan Dorman at 2026-02-09T08:11:51-05:00
Remove `extra_src_files` variable from `testsuite/driver/testlib.py`
While reading through the test harness code, I noticed this variable
with a TODO attached that referenced #12223. Although that bug is
closed, it strongly implied that this special-case variable that only
affected a single test was expected to be removed at some point.
I also looked at 3415bcaa0b1903b5e12dfaadb5b774718e406eab---where it
was added---whose commit message suggested that it would have been
desirable to remove it, but that there were special circumstances that
meant it had to remain (though it doesn't elucidate what those special
circumstances are).
However, the special circumstances were mentioned as if the test was
in a different location than is currently is, so I decided to try
changing the test to use the standard `extra_files` mechanism, which
works in local testing.
This also seems like a reasonable time to remove the script that was
originally used in the transition, since it doesn't really serve a
purpose anymore.
- - - - -
0020e38a by Matthew Pickering at 2026-02-09T17:29:14-05:00
determinism: Use a stable sort in WithHsDocIdentifiers binary instance
`WithHsDocIdentifiers` is defined as
```
71 data WithHsDocIdentifiers a pass = WithHsDocIdentifiers
72 { hsDocString :: !a
73 , hsDocIdentifiers :: ![Located (IdP pass)]
74 }
```
This list of names is populated from `rnHsDocIdentifiers`, which calls
`lookupGRE`, which calls `lookupOccEnv_AllNameSpaces`, which calls
`nonDetEltsUFM` and returns the results in an order depending on
uniques.
Sorting the list with a stable sort before returning the interface makes
the output deterministic and follows the approach taken by other fields
in `Docs`.
Fixes #26858
- - - - -
89898ce6 by echoumcp1 at 2026-02-09T17:30:01-05:00
Replace putstrln with logMsg in handleSeqHValueStatus
Fixes #26549
- - - - -
7c52c4f9 by John Paul Adrian Glaubitz at 2026-02-10T13:52:43-05:00
rts: Switch prim to use modern atomic compiler builtins
The __sync_*() atomic compiler builtins have been deprecated in GCC
for a while now and also don't provide variants for 64-bit values
such as __sync_fetch_and_add_8().
Thus, replace them with the modern __atomic_*() compiler builtins and
while we're at it, also drop the helper macro CAS_NAND() which is now
no longer needed since we stopped using the __sync_*() compiler builtins
altogether.
Co-authored-by: Ilias Tsitsimpis <iliastsi(a)debian.org>
Fixes #26729
- - - - -
cf60850a by Recursion Ninja at 2026-02-10T13:53:27-05:00
Decoupling L.H.S.Decls from GHC.Types.ForeignCall
- Adding TTG extension point for 'CCallTarget'
- Adding TTG extension point for 'CType'
- Adding TTG extension point for 'Header'
- Moving ForeignCall types that do not need extension
to new L.H.S.Decls.Foreign module
- Replacing 'Bool' parameters with descriptive data-types
to increase clairty and prevent "Boolean Blindness"
- - - - -
11a04cbb by Eric Lee at 2026-02-11T09:20:46-05:00
Derive Semigroup/Monoid for instances believed could be derived in #25871
- - - - -
15d9ce44 by Eric Lee at 2026-02-11T09:20:46-05:00
add Ghc.Data.Pair deriving
- - - - -
c85dc170 by Evan Piro at 2026-02-11T09:21:45-05:00
Linker.MacOS reduce options import
- - - - -
a541dd83 by Chris Wendt at 2026-02-11T16:06:41-05:00
Initialize plugins for `:set +c` in GHCi
Fixes #23110.
- - - - -
0f5a73bc by Cheng Shao at 2026-02-11T16:07:27-05:00
compiler: add Binary Text instance
This patch adds `Binary` instance for strict `Text`, in preparation of
making `Text` usable in certain GHC API use cases (e.g. haddock). This
also introduces `text` as a direct dependency of the `ghc` package.
- - - - -
9e58b8a1 by Cheng Shao at 2026-02-11T16:08:10-05:00
ghc-toolchain: add C11 check
This patch partially reverts commit
b8307eab80c5809df5405d76c822bf86877f5960 that removed C99 check in
autoconf/ghc-toolchain. Now we:
- No longer re-implement `FP_SET_CFLAGS_C11` similar to
`FP_SET_CFLAGS_C99` in the past, since autoconf doesn't provide a
convenient `AC_PROG_CC_C11` function. ghc-toolchain will handle it
anyway.
- The Cmm CPP C99 check is relanded and repurposed for C11.
- The C99 logic in ghc-toolchain is relanded and repurposed for C11.
- The C99 check in Stg.h is corrected to check for C11. The obsolete
_ISOC99_SOURCE trick is dropped.
- Usages of `-std=gnu99` in the testsuite are corrected to use
`-std=gnu11`.
Closes #26908.
- - - - -
4df0adf6 by Simon Peyton Jones at 2026-02-11T21:50:13-05:00
Simplify the treatment of static forms
This MR implements GHC proposal 732: simplify static forms,
https://github.com/ghc-proposals/ghc-proposals/pull/732
thereby addressing #26556.
See `Note [Grand plan for static forms]` in GHC.Iface.Tidy.StaticPtrTable
The main changes are:
* There is a new, simple rule for (static e), namely that the free
term variables of `e` must be bound at top level. The check is
done in the `HsStatic` case of `GHC.Rename.Expr.rnExpr`
* That in turn substantially simplifies the info that the typechecker
carries around in its type environment. Hooray.
* The desugarer emits static bindings to top level directly; see the
`HsStatic` case of `dsExpr`.
* There is no longer any special static-related magic in the FloatOut
pass. And the main Simplifier pipeline no longer needs a special case
to run FloatOut even with -O0. Hooray.
All this forced an unexpected change to the pattern match checker. It
recursively invokes the main Hs desugarer when it wants to take a look
at a term to spot some special cases (notably constructor applications).
We don't want to emit any nested (static e) bindings to top level a
second time! Yikes.
That forced a modest refactor in GHC.HsToCore.Pmc:
* The `dsl_nablas` field of `DsLclEnv` now has a `NoPmc` case, which says
"I'm desugaring just for pattern-match checking purposes".
* When that flag is set we don't emit static binds.
That in turn forces a cascade of refactoring, but the net effect is an
improvement; less risk of duplicated (even exponential?) work.
See Note [Desugaring HsExpr during pattern-match checking].
10% metric decrease, on some architectures, of compile-time max-bytes-used on T15304.
Metric Decrease:
T15304
- - - - -
7922f728 by Teo Camarasu at 2026-02-11T21:50:58-05:00
ghc-internal: avoid depending on GHC.Internal.Exts
This module is mostly just re-exports. It made sense as a user-facing
module, but there's no good reason ghc-internal modules should depend on
it and doing so linearises the module graph
- move considerAccessible to GHC.Internal.Magic
Previously it lived in GHC.Internal.Exts, but it really deserves to live
along with the other magic function, which are already re-exported from .Exts
- move maxTupleSize to GHC.Internal.Tuple
This previously lived in GHC.Internal.Exts but a comment already said it
should be moved to .Tuple
Resolves #26832
- - - - -
b6a4a29b by Eric Lee at 2026-02-11T21:51:55-05:00
Remove unused Semigroup imports to fix GHC 9.14 bootstrapping
- - - - -
99d8c146 by Simon Peyton Jones at 2026-02-12T17:36:59+00:00
Fix subtle bug in cast worker/wrapper
See (CWw4) in Note [Cast worker/wrapper].
The true payload is in the change to the definition of
GHC.Types.Id.Info.hasInlineUnfolding
Everthing else is just documentation.
There is a 2% compile time decrease for T13056;
I'll take the win!
Metric Decrease:
T13056
- - - - -
530e8e58 by Simon Peyton Jones at 2026-02-12T20:17:23-05:00
Add regression tests for four StaticPtr bugs
Tickets #26545, #24464, #24773, #16981 are all solved by the
recently-landed MR
commit 318ee13bcffa6aa8df42ba442ccd92aa0f7e210c
Author: Simon Peyton Jones <simon.peytonjones(a)gmail.com>
Date: Mon Oct 20 23:07:20 2025 +0100
Simplify the treatment of static forms
This MR just adds regression tests for them.
- - - - -
4157160f by Cheng Shao at 2026-02-13T06:27:04-05:00
ci: remove unused hlint-ghc-and-base job definition
This patch removes the unused `hlint-ghc-and-base` job definition,
it's never run since !9806. Note that hadrian lint rules still work
locally, so anyone that wishes to run hlint on the codebase can
continue to do so in their local worktree.
- - - - -
039f1977 by Cheng Shao at 2026-02-13T06:27:47-05:00
wasm: use import.meta.main for proper distinction of nodejs main modules
This patch uses `import.meta.main` for proper distinction of nodejs
main modules, especially when the main module might be installed as a
symlink. Fixes #26916.
- - - - -
14f485ee by ARATA Mizuki at 2026-02-17T09:09:24+09:00
Support more x86 extensions: AVX-512 {BW,DQ,VL} and GFNI
Also, mark AVX-512 ER and PF as deprecated.
AVX-512 instructions can be used for certain 64-bit integer vector operations.
GFNI can be used to implement bitReverse (currently not used by NCG, but LLVM may use it).
Closes #26406
Addresses #26509
- - - - -
016f79d5 by fendor at 2026-02-17T09:16:16-05:00
Hide implementation details from base exception stack traces
Ensure we hide the implementation details of the exception throwing mechanisms:
* `undefined`
* `throwSTM`
* `throw`
* `throwIO`
* `error`
The `HasCallStackBacktrace` should always have a length of exactly 1,
not showing internal implementation details in the stack trace, as these
are vastly distracting to end users.
CLC proposal [#387](https://github.com/haskell/core-libraries-committee/issues/387)
- - - - -
4f2840f2 by Brian J. Cardiff at 2026-02-17T17:04:08-05:00
configure: Accept happy-2.2
In Jan 2026 happy-2.2 was released. The most sensible change is https://github.com/haskell/happy/issues/335 which didn't trigger in a fresh build
- - - - -
10b4d364 by Duncan Coutts at 2026-02-17T17:04:52-05:00
Fix errors in the documentation of the eventlog STOP_THREAD status codes
Fix the code for BlockedOnMsgThrowTo.
Document all the known historical warts.
Fixes issue #26867
- - - - -
c5e15b8b by Phil de Joux at 2026-02-18T05:07:36-05:00
haddock: use snippets for all list examples
- generate snippet output for docs
- reduce font size to better fit snippets
- Use only directive to guard html snippets
- Add latex snippets for lists
- - - - -
d388bac1 by Phil de Joux at 2026-02-18T05:07:36-05:00
haddock: Place the snippet input and output together
- Put the output seemingly inside the example box
- - - - -
016fa306 by Samuel Thibault at 2026-02-18T05:08:35-05:00
Fix linking against libm by moving the -lm option
For those systems that need -lm for getting math functions, this is
currently added on the link line very early, before the object files being
linked together. Newer toolchains enable --as-needed by default, which means
-lm is ignored at that point because no object requires a math function
yet. With such toolchains, we thus have to add -lm after the objects, so the
linker actually includes libm in the link.
- - - - -
68bd0805 by Teo Camarasu at 2026-02-18T05:09:19-05:00
ghc-internal: Move GHC.Internal.Data.Bool to base
This is a tiny module that only defines bool :: Bool -> a -> a -> a. We can just move this to base and delete it from ghc-internal. If we want this functionality there we can just use a case statement or if-then expression.
Resolves 26865
- - - - -
4c40df3d by fendor at 2026-02-20T10:24:48-05:00
Add optional `SrcLoc` to `StackAnnotation` class
`StackAnnotation`s give access to an optional `SrcLoc` field that
user-added stack annotations can use to provide better backtraces in both error
messages and when decoding the callstack.
We update builtin stack annotations such as `StringAnnotation` and
`ShowAnnotation` to also capture the `SrcLoc` of the current `CallStack`
to improve backtraces by default (if stack annotations are used).
This change is backwards compatible with GHC 9.14.1.
- - - - -
fd9aaa28 by Simon Hengel at 2026-02-20T10:25:33-05:00
docs: Fix grammar in explicit_namespaces.rst
- - - - -
44354255 by Vo Minh Thu at 2026-02-20T18:53:06-05:00
GHCi: add a :version command.
This looks like:
ghci> :version
GHCi, version 9.11.20240322
This closes #24576.
Co-Author: Markus Läll <markus.l2ll(a)gmail.com>
- - - - -
eab3dbba by Andreas Klebinger at 2026-02-20T18:53:51-05:00
hadrian/build-cabal: Better respect and utilize -j
* We now respect -j<n> for the cabal invocation to build hadrian rather
than hardcoding -j
* We use the --semaphore flag to ensure cabal/ghc build the hadrian
executable in parallel using the -jsem mechanism.
Saves 10-15s on fresh builds for me.
Fixes #26876
- - - - -
7545e968 by Rodrigo Mesquita at 2026-02-24T11:16:06+00:00
Add test for #25636
The existing test behaviour of "T23146_liftedeq" changed because the
simplifier now does a bit more inlining. We can restore the previous bad
behavior by using an OPAQUE pragma.
This test doubles as a test for #25636 when run in ghci, so we add it as
such.
- - - - -
0300e39d by Rodrigo Mesquita at 2026-02-24T11:16:06+00:00
refactor: protoBCOName is always a Name
Simplifies the code by removing the unnecessary type argument to
ProtoBCO which was always 'Name'
- - - - -
d03d71ad by Rodrigo Mesquita at 2026-02-24T11:16:07+00:00
Allocate static constructors for bytecode
This commit adds support for static constructors when compiling and
linking ByteCode objects.
Top-level StgRhsCon get lowered to ProtoStaticCons rather than to
ProtoBCOs. A ProtoStaticCon gets allocated directly as a data con
application on the heap (using the new primop newConApp#).
Previously, we would allocate a ProtoBCO which, when evaluated, would
PACK and return the constructor.
A few more details are given in Note [Static constructors in Bytecode].
Secondly, this commit also fixes issue #25636 which was caused by
linking *unlifted* constructors in BCO instructions as
- (1) a thunk indexing the array of BCOs in a module
- (2) which evaluated to a BCO which still had to be evaluated to
return the unlifted constructor proper.
The (2) issue has been resolved by allocating the static constructors
directly. The (1) issue can be resolved by ensuring that we allocate all
unlifted top-level constructors eagerly, and leave the knot-tying for
the lifted BCOs and top-level constructors only.
The top-level unlifted constructors are never mutually recursive, so we
can allocate them all in one go as long as we do it in topological
order. Lifted fields of unlifted constructors can still be filled by the
knot-tied lifted variables since in those fields it is fine to keep
those thunks. See Note [Tying the knot in createBCOs] for more details.
Fixes #25636
- - - - -
9980cc62 by Rodrigo Mesquita at 2026-02-24T11:16:07+00:00
Revert "StgToByteCode: Assert that PUSH_G'd values are lifted"
This reverts commit ec26c54d818e0cd328276196930313f66b780905.
Ever since f7a22c0f4e9ae0dc767115d4c53fddbd8372b777, we now do support
and will link top-level unlifted constructors into evaluated and
properly tagged values which we can reference with PUSH_G.
This assertion is no longer true and triggered a failure in T25636
- - - - -
cbf05e13 by Rodrigo Mesquita at 2026-02-24T11:16:08+00:00
refactor: Tag more remote Ptrs as RemotePtr
Pure refactor which improves the API of
- GHC.ByteCode.Linker
- GHC.Runtime.Interpreter
- GHC.Runtime.Interpreter.Types.SymbolCache
by using `RemotePtr` for more functions which used to return `Ptr`s that
could potentially be in a foreign process. E.g. `lookupIE`,
`lookupStaticPtr`, etc...
- - - - -
17e4fe35 by Rodrigo Mesquita at 2026-02-24T11:16:08+00:00
Add float# and subword tests for #25636
These tests cover that static constructors in bytecode work correctly
for Float# and subword values (Word8#, Word16#)
- - - - -
5de8d129 by Rodrigo Mesquita at 2026-02-24T11:16:08+00:00
COMMENTS
- - - - -
798f518d by Rodrigo Mesquita at 2026-02-24T11:16:09+00:00
wip: start fixing, but manually packing things is kind of awful. how to do better? [skip ci]
- - - - -
579 changed files:
- .gitignore
- .gitlab-ci.yml
- .gitlab/ci.sh
- .gitlab/darwin/nix/sources.json
- .gitlab/darwin/toolchain.nix
- + .gitlab/generate-ci/cabal.project
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/ByteCode/Asm.hs
- compiler/GHC/ByteCode/Instr.hs
- compiler/GHC/ByteCode/Linker.hs
- compiler/GHC/ByteCode/Serialize.hs
- compiler/GHC/ByteCode/Types.hs
- compiler/GHC/Cmm/Liveness.hs
- compiler/GHC/CmmToAsm/Config.hs
- compiler/GHC/CmmToAsm/LA64/CodeGen.hs
- compiler/GHC/CmmToAsm/PPC/CodeGen.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/CmmToAsm/X86/Instr.hs
- compiler/GHC/CmmToAsm/X86/Ppr.hs
- compiler/GHC/CmmToLlvm/CodeGen.hs
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/FamInstEnv.hs
- compiler/GHC/Core/InstEnv.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Map/Type.hs
- compiler/GHC/Core/Opt/OccurAnal.hs
- compiler/GHC/Core/Opt/Pipeline.hs
- compiler/GHC/Core/Opt/SetLevels.hs
- compiler/GHC/Core/Opt/Simplify/Env.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/Opt/WorkWrap.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.hs
- compiler/GHC/Core/TyCon/RecWalk.hs
- compiler/GHC/Core/Utils.hs
- compiler/GHC/CoreToStg.hs
- compiler/GHC/CoreToStg/AddImplicitBinds.hs
- compiler/GHC/Data/Maybe.hs
- compiler/GHC/Data/Pair.hs
- compiler/GHC/Driver/Config/CmmToAsm.hs
- compiler/GHC/Driver/Config/Core/Lint.hs
- compiler/GHC/Driver/DynFlags.hs
- compiler/GHC/Driver/Pipeline/Execute.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Hs/Binds.hs
- compiler/GHC/Hs/Decls.hs
- + compiler/GHC/Hs/Decls/Overlap.hs
- compiler/GHC/Hs/Doc.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Instances.hs
- compiler/GHC/Hs/Lit.hs
- compiler/GHC/Hs/Syn/Type.hs
- compiler/GHC/Hs/Type.hs
- compiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore.hs
- compiler/GHC/HsToCore/Docs.hs
- compiler/GHC/HsToCore/Errors/Types.hs
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/Foreign/C.hs
- compiler/GHC/HsToCore/Foreign/Call.hs
- compiler/GHC/HsToCore/Foreign/Decl.hs
- compiler/GHC/HsToCore/Foreign/JavaScript.hs
- compiler/GHC/HsToCore/Foreign/Utils.hs
- compiler/GHC/HsToCore/Foreign/Wasm.hs
- compiler/GHC/HsToCore/GuardedRHSs.hs
- compiler/GHC/HsToCore/Match.hs
- compiler/GHC/HsToCore/Match/Literal.hs
- compiler/GHC/HsToCore/Monad.hs
- compiler/GHC/HsToCore/Pmc.hs
- compiler/GHC/HsToCore/Pmc/Desugar.hs
- compiler/GHC/HsToCore/Pmc/Solver.hs
- compiler/GHC/HsToCore/Pmc/Solver/Types.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/HsToCore/Ticks.hs
- compiler/GHC/HsToCore/Types.hs
- compiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Iface/Syntax.hs
- compiler/GHC/Iface/Tidy.hs
- compiler/GHC/Iface/Tidy/StaticPtrTable.hs
- compiler/GHC/Linker/Dynamic.hs
- compiler/GHC/Linker/Loader.hs
- compiler/GHC/Linker/MacOS.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Parser/PostProcess/Haddock.hs
- compiler/GHC/Parser/String.hs
- compiler/GHC/Rename/Bind.hs
- compiler/GHC/Rename/Env.hs
- compiler/GHC/Rename/Expr.hs
- compiler/GHC/Rename/HsType.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/Rename/Names.hs
- compiler/GHC/Rename/Splice.hs
- compiler/GHC/Rename/Splice.hs-boot
- compiler/GHC/Rename/Unbound.hs
- compiler/GHC/Runtime/Heap/Inspect.hs
- compiler/GHC/Runtime/Interpreter.hs
- compiler/GHC/Runtime/Interpreter/Types/SymbolCache.hs
- compiler/GHC/StgToByteCode.hs
- compiler/GHC/StgToCmm/Closure.hs
- compiler/GHC/StgToCmm/DataCon.hs
- compiler/GHC/StgToCmm/Foreign.hs
- compiler/GHC/StgToCmm/Layout.hs
- compiler/GHC/StgToCmm/Prim.hs
- compiler/GHC/StgToJS/FFI.hs
- compiler/GHC/StgToJS/Prim.hs
- compiler/GHC/SysTools/Cpp.hs
- compiler/GHC/Tc/Deriv.hs
- compiler/GHC/Tc/Deriv/Utils.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/Foreign.hs
- compiler/GHC/Tc/Gen/Head.hs
- compiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Tc/Gen/Pat.hs
- compiler/GHC/Tc/Gen/Sig.hs
- compiler/GHC/Tc/Instance/Class.hs
- compiler/GHC/Tc/Instance/Family.hs
- compiler/GHC/Tc/Module.hs
- compiler/GHC/Tc/Solver.hs
- compiler/GHC/Tc/Solver/Default.hs
- compiler/GHC/Tc/Solver/Dict.hs
- compiler/GHC/Tc/Solver/Equality.hs
- compiler/GHC/Tc/Solver/InertSet.hs
- compiler/GHC/Tc/Solver/Monad.hs
- compiler/GHC/Tc/Solver/Solve.hs
- compiler/GHC/Tc/TyCl.hs
- compiler/GHC/Tc/TyCl/Instance.hs
- compiler/GHC/Tc/TyCl/Utils.hs
- compiler/GHC/Tc/Types.hs
- compiler/GHC/Tc/Types/BasicTypes.hs
- compiler/GHC/Tc/Types/Constraint.hs
- compiler/GHC/Tc/Types/CtLoc.hs
- compiler/GHC/Tc/Types/ErrCtxt.hs
- compiler/GHC/Tc/Types/Evidence.hs
- compiler/GHC/Tc/Types/Origin.hs
- compiler/GHC/Tc/Utils/Env.hs
- compiler/GHC/Tc/Utils/Instantiate.hs
- compiler/GHC/Tc/Utils/Monad.hs
- compiler/GHC/Tc/Utils/TcMType.hs
- − compiler/GHC/Tc/Utils/TcMType.hs-boot
- compiler/GHC/Tc/Utils/Unify.hs
- compiler/GHC/Tc/Zonk/TcType.hs
- compiler/GHC/Tc/Zonk/Type.hs
- compiler/GHC/ThToHs.hs
- compiler/GHC/Types/Basic.hs
- compiler/GHC/Types/Error/Codes.hs
- compiler/GHC/Types/ForeignCall.hs
- compiler/GHC/Types/Id/Info.hs
- compiler/GHC/Types/Id/Make.hs
- compiler/GHC/Types/InlinePragma.hs
- compiler/GHC/Types/Name.hs
- compiler/GHC/Types/Name/Cache.hs
- compiler/GHC/Types/RepType.hs
- compiler/GHC/Types/Unique/DSet.hs
- compiler/GHC/Types/Var.hs
- compiler/GHC/Unit/Module/ModIface.hs
- compiler/GHC/Unit/State.hs
- compiler/GHC/Unit/Types.hs
- compiler/GHC/Utils/Binary.hs
- compiler/GHC/Utils/Monad.hs
- compiler/GHC/Utils/Outputable.hs
- compiler/GHC/Utils/Ppr/Colour.hs
- compiler/GHC/Utils/Trace.hs
- compiler/Language/Haskell/Syntax/Basic.hs
- compiler/Language/Haskell/Syntax/Decls.hs
- + compiler/Language/Haskell/Syntax/Decls/Foreign.hs
- + compiler/Language/Haskell/Syntax/Decls/Overlap.hs
- compiler/Language/Haskell/Syntax/Extension.hs
- compiler/Language/Haskell/Syntax/Lit.hs
- compiler/ghc.cabal.in
- configure.ac
- distrib/configure.ac.in
- + docs/users_guide/10.0.1-notes.rst
- docs/users_guide/9.16.1-notes.rst
- docs/users_guide/eventlog-formats.rst
- docs/users_guide/exts/explicit_namespaces.rst
- docs/users_guide/exts/multiway_if.rst
- docs/users_guide/exts/roles.rst
- docs/users_guide/ghci.rst
- docs/users_guide/index.rst
- docs/users_guide/phases.rst
- docs/users_guide/rtd-theme/layout.html
- docs/users_guide/runtime_control.rst
- docs/users_guide/using.rst
- ghc/GHCi/UI.hs
- ghc/GHCi/UI/Info.hs
- hadrian/build-cabal
- hadrian/doc/user-settings.md
- hadrian/hadrian.cabal
- hadrian/src/Builder.hs
- hadrian/src/Context.hs
- hadrian/src/Flavour.hs
- hadrian/src/Hadrian/Utilities.hs
- hadrian/src/Rules/Compile.hs
- hadrian/src/Rules/Docspec.hs
- hadrian/src/Rules/Documentation.hs
- hadrian/src/Rules/Lint.hs
- hadrian/src/Settings/Builders/Cc.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/Packages.hs
- libraries/Cabal
- libraries/base/base.cabal.in
- libraries/base/changelog.md
- libraries/base/src/Control/Concurrent.hs
- libraries/base/src/Data/Bool.hs
- libraries/base/src/Data/Ix.hs
- libraries/base/src/Data/List.hs
- libraries/base/src/Data/List/NubOrdSet.hs
- − libraries/base/src/GHC/Desugar.hs
- libraries/base/src/GHC/Exts.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/deepseq
- libraries/directory
- libraries/exceptions
- 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/Stack/Annotation/Experimental.hs
- + libraries/ghc-experimental/tests/Makefile
- + libraries/ghc-experimental/tests/all.T
- + libraries/ghc-experimental/tests/backtraces/Makefile
- + libraries/ghc-experimental/tests/backtraces/T26806a.hs
- + libraries/ghc-experimental/tests/backtraces/T26806a.stderr
- + libraries/ghc-experimental/tests/backtraces/T26806b.hs
- + libraries/ghc-experimental/tests/backtraces/T26806b.stderr
- + libraries/ghc-experimental/tests/backtraces/T26806c.hs
- + libraries/ghc-experimental/tests/backtraces/T26806c.stderr
- + libraries/ghc-experimental/tests/backtraces/all.T
- 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/Bool.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Data.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Foldable.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Function.hs
- − libraries/ghc-internal/src/GHC/Internal/Data/Ix.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Type/Bool.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Type/Ord.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Version.hs
- libraries/ghc-internal/src/GHC/Internal/Err.hs
- libraries/ghc-internal/src/GHC/Internal/Exception.hs
- libraries/ghc-internal/src/GHC/Internal/Exts.hs
- libraries/ghc-internal/src/GHC/Internal/Functor/ZipList.hs
- libraries/ghc-internal/src/GHC/Internal/Heap/Closures.hs
- libraries/ghc-internal/src/GHC/Internal/IO/FD.hs
- libraries/ghc-internal/src/GHC/Internal/JS/Foreign/Callback.hs
- libraries/ghc-internal/src/GHC/Internal/JS/Prim.hs
- libraries/ghc-internal/src/GHC/Internal/JS/Prim/Internal/Build.hs
- libraries/ghc-internal/src/GHC/Internal/Magic.hs
- libraries/ghc-internal/src/GHC/Internal/STM.hs
- libraries/ghc-internal/src/GHC/Internal/Stack/Annotation.hs
- libraries/ghc-internal/src/GHC/Internal/Stack/Decode.hs
- + libraries/ghc-internal/src/GHC/Internal/System/IO/OS.hs
- libraries/ghc-internal/src/GHC/Internal/TH/Lift.hs
- libraries/ghc-internal/src/GHC/Internal/Tuple.hs
- libraries/ghc-internal/src/GHC/Internal/TypeError.hs
- libraries/ghc-internal/src/GHC/Internal/Wasm/Prim/Exports.hs
- libraries/ghc-internal/src/GHC/Internal/Wasm/Prim/Imports.hs
- libraries/ghc-internal/src/GHC/Internal/Wasm/Prim/Types.hs
- + libraries/ghc-internal/tests/backtraces/T15395.hs
- + libraries/ghc-internal/tests/backtraces/T15395.stdout
- libraries/ghc-internal/tests/backtraces/all.T
- libraries/ghc-internal/tests/stack-annotation/all.T
- libraries/ghc-internal/tests/stack-annotation/ann_frame001.stdout
- libraries/ghc-internal/tests/stack-annotation/ann_frame002.stdout
- libraries/ghc-internal/tests/stack-annotation/ann_frame003.stdout
- libraries/ghc-internal/tests/stack-annotation/ann_frame004.stdout
- + libraries/ghc-internal/tests/stack-annotation/ann_frame005.hs
- + libraries/ghc-internal/tests/stack-annotation/ann_frame005.stdout
- libraries/ghci/GHCi/CreateBCO.hs
- libraries/ghci/GHCi/ResolvedBCO.hs
- libraries/ghci/GHCi/Server.hs
- libraries/text
- libraries/transformers
- llvm-targets
- m4/fp_cmm_cpp_cmd_with_args.m4
- m4/fptools_happy.m4
- rts/AllocArray.c
- rts/AllocArray.h
- rts/ClosureTable.c
- rts/Heap.c
- rts/Interpreter.c
- rts/PrimOps.cmm
- rts/RtsFlags.c
- rts/RtsSymbols.c
- rts/Threads.c
- rts/Trace.c
- rts/Weak.c
- rts/include/Cmm.h
- rts/include/Rts.h
- rts/include/Stg.h
- rts/include/rts/Flags.h
- rts/include/rts/storage/ClosureMacros.h
- rts/include/stg/MiscClosures.h
- rts/include/stg/Ticky.h
- rts/prim/atomic.c
- 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/cpu_features.py
- − testsuite/driver/kill_extra_files.py
- testsuite/driver/runtests.py
- testsuite/driver/testglobals.py
- testsuite/driver/testlib.py
- testsuite/driver/testutil.py
- testsuite/mk/test.mk
- testsuite/tests/arrows/should_compile/T21301.stderr
- testsuite/tests/backpack/cabal/bkpcabal08/bkpcabal08.stdout
- testsuite/tests/codeGen/should_gen_asm/all.T
- + testsuite/tests/codeGen/should_gen_asm/avx512-int64-minmax.asm
- + testsuite/tests/codeGen/should_gen_asm/avx512-int64-minmax.hs
- + testsuite/tests/codeGen/should_gen_asm/avx512-int64-mul.asm
- + testsuite/tests/codeGen/should_gen_asm/avx512-int64-mul.hs
- + testsuite/tests/codeGen/should_gen_asm/avx512-word64-minmax.asm
- + testsuite/tests/codeGen/should_gen_asm/avx512-word64-minmax.hs
- testsuite/tests/codeGen/should_run/CgStaticPointers.hs
- testsuite/tests/codeGen/should_run/CgStaticPointersNoFullLazyness.hs
- testsuite/tests/codeGen/should_run/T23146/T23146_liftedeq.hs
- + testsuite/tests/codeGen/should_run/T23146/T25636.script
- + testsuite/tests/codeGen/should_run/T23146/T25636.stdout
- testsuite/tests/codeGen/should_run/T23146/all.T
- + testsuite/tests/codeGen/should_run/T25636a/T25636a.script
- + testsuite/tests/codeGen/should_run/T25636a/T25636a.stdout
- + testsuite/tests/codeGen/should_run/T25636a/all.T
- + testsuite/tests/codeGen/should_run/T25636b/T25636b.script
- + testsuite/tests/codeGen/should_run/T25636b/T25636b.stdout
- + testsuite/tests/codeGen/should_run/T25636b/all.T
- testsuite/tests/count-deps/CountDepsAst.stdout
- testsuite/tests/count-deps/CountDepsParser.stdout
- testsuite/tests/deSugar/should_fail/DsStrictFail.stderr
- testsuite/tests/deSugar/should_run/T20024.stderr
- testsuite/tests/deSugar/should_run/dsrun005.stderr
- testsuite/tests/deSugar/should_run/dsrun007.stderr
- testsuite/tests/deSugar/should_run/dsrun008.stderr
- + testsuite/tests/default/T25825.hs
- testsuite/tests/default/all.T
- testsuite/tests/deriving/should_fail/T1496.stderr
- testsuite/tests/deriving/should_fail/T4846.stderr
- testsuite/tests/deriving/should_fail/T5498.stderr
- testsuite/tests/deriving/should_fail/T6147.stderr
- testsuite/tests/deriving/should_fail/T7148.stderr
- testsuite/tests/deriving/should_fail/T7148a.stderr
- testsuite/tests/deriving/should_fail/T8984.stderr
- testsuite/tests/deriving/should_fail/deriving-via-fail.stderr
- testsuite/tests/deriving/should_fail/deriving-via-fail4.stderr
- testsuite/tests/deriving/should_fail/deriving-via-fail5.stderr
- testsuite/tests/deriving/should_run/T9576.stderr
- testsuite/tests/driver/T16318/Makefile
- testsuite/tests/driver/T18125/Makefile
- testsuite/tests/driver/T20030/test1/all.T
- testsuite/tests/driver/T20030/test2/all.T
- testsuite/tests/driver/T20030/test3/all.T
- testsuite/tests/driver/T20030/test4/all.T
- testsuite/tests/driver/T20030/test5/all.T
- testsuite/tests/driver/T20030/test6/all.T
- testsuite/tests/driver/T8526/T8526.script
- testsuite/tests/driver/bytecode-object/Makefile
- testsuite/tests/driver/bytecode-object/bytecode_object19.stdout
- testsuite/tests/driver/dynamicToo/dynamicToo001/Makefile
- testsuite/tests/driver/fat-iface/fat014.script
- testsuite/tests/driver/implicit-dyn-too/Makefile
- testsuite/tests/driver/multipleHomeUnits/all.T
- testsuite/tests/driver/multipleHomeUnits/multipleHomeUnits_recomp_th.stdout
- testsuite/tests/ffi/should_run/all.T
- testsuite/tests/gadt/CasePrune.stderr
- + testsuite/tests/ghc-api/TypeMapStringLiteral.hs
- testsuite/tests/ghc-api/all.T
- 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/T26042f2.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/ghci.debugger/scripts/print034.stdout
- − testsuite/tests/ghci/linking/T11531.stderr
- testsuite/tests/ghci/prog018/prog018.script
- testsuite/tests/ghci/scripts/Defer02.stderr
- testsuite/tests/ghci/scripts/T13869.script
- testsuite/tests/ghci/scripts/T13997.script
- testsuite/tests/ghci/scripts/T15325.stderr
- testsuite/tests/ghci/scripts/T17669.script
- testsuite/tests/ghci/scripts/T18330.script
- testsuite/tests/ghci/scripts/T18330.stdout
- testsuite/tests/ghci/scripts/T1914.script
- testsuite/tests/ghci/scripts/T20150.stdout
- testsuite/tests/ghci/scripts/T20217.script
- testsuite/tests/ghci/scripts/T6105.script
- testsuite/tests/ghci/scripts/T8042.script
- testsuite/tests/ghci/scripts/T8042recomp.script
- testsuite/tests/ghci/should_run/Makefile
- 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/linters/regex-linters/check-rts-includes.py
- testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
- testsuite/tests/parser/should_compile/T14189.stderr
- testsuite/tests/parser/should_fail/RecordDotSyntaxFail8.stderr
- + testsuite/tests/parser/should_fail/T26860ppr.hs
- + testsuite/tests/parser/should_fail/T26860ppr.stderr
- testsuite/tests/parser/should_fail/all.T
- testsuite/tests/patsyn/should_run/ghci.stderr
- + testsuite/tests/plugins/T23110.hs
- + testsuite/tests/plugins/T23110.script
- + testsuite/tests/plugins/T23110.stdout
- testsuite/tests/plugins/all.T
- testsuite/tests/process/all.T
- testsuite/tests/quotes/LiftErrMsgDefer.stderr
- testsuite/tests/rename/should_fail/RnStaticPointersFail01.stderr
- testsuite/tests/rename/should_fail/RnStaticPointersFail03.stderr
- + testsuite/tests/rename/should_fail/T26545.hs
- + testsuite/tests/rename/should_fail/T26545.stderr
- testsuite/tests/rename/should_fail/all.T
- testsuite/tests/roles/should_fail/RolesIArray.stderr
- testsuite/tests/rts/Makefile
- testsuite/tests/rts/T13676.script
- testsuite/tests/rts/all.T
- testsuite/tests/rts/ipe/all.T
- testsuite/tests/safeHaskell/safeLanguage/SafeLang15.stderr
- testsuite/tests/showIface/DocsInHiFile1.stdout
- testsuite/tests/showIface/HaddockSpanIssueT24378.stdout
- testsuite/tests/showIface/MagicHashInHaddocks.stdout
- testsuite/tests/simd/should_run/all.T
- testsuite/tests/simplCore/should_compile/T21391.hs
- + testsuite/tests/simplCore/should_compile/T26805.hs
- + testsuite/tests/simplCore/should_compile/T26805.stderr
- + testsuite/tests/simplCore/should_compile/T26826.hs
- + testsuite/tests/simplCore/should_compile/T26903.hs
- + testsuite/tests/simplCore/should_compile/T26903.stderr
- testsuite/tests/simplCore/should_compile/T8331.stderr
- testsuite/tests/simplCore/should_compile/all.T
- + testsuite/tests/th/T26098A_quote.hs
- + testsuite/tests/th/T26098A_splice.hs
- + testsuite/tests/th/T26098_local.hs
- + testsuite/tests/th/T26098_local.stderr
- + testsuite/tests/th/T26098_quote.hs
- + testsuite/tests/th/T26098_quote.stderr
- + testsuite/tests/th/T26098_splice.hs
- + testsuite/tests/th/T26098_splice.stderr
- testsuite/tests/th/TH_implicitParams.stdout
- testsuite/tests/th/all.T
- testsuite/tests/type-data/should_run/T22332a.stderr
- + testsuite/tests/typecheck/should_compile/T24464.hs
- + 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
- testsuite/tests/typecheck/should_run/T10284.stderr
- testsuite/tests/typecheck/should_run/T13838.stderr
- + testsuite/tests/typecheck/should_run/T16981.hs
- + testsuite/tests/typecheck/should_run/T16981.stdout
- + testsuite/tests/typecheck/should_run/T24773.hs
- + testsuite/tests/typecheck/should_run/T24773.stdout
- testsuite/tests/typecheck/should_run/T9497a-run.stderr
- testsuite/tests/typecheck/should_run/T9497b-run.stderr
- testsuite/tests/typecheck/should_run/T9497c-run.stderr
- testsuite/tests/typecheck/should_run/all.T
- testsuite/tests/unsatisfiable/T23816.stderr
- testsuite/tests/unsatisfiable/UnsatDefer.stderr
- testsuite/tests/warnings/should_fail/CaretDiagnostics1.stderr
- utils/check-exact/ExactPrint.hs
- utils/deriveConstants/Main.hs
- utils/ghc-toolchain/exe/Main.hs
- utils/ghc-toolchain/src/GHC/Toolchain/Tools/Cc.hs
- utils/ghc-toolchain/src/GHC/Toolchain/Tools/Cpp.hs
- utils/haddock/doc/.gitignore
- utils/haddock/doc/Makefile
- + utils/haddock/doc/_static/haddock-custom.css
- utils/haddock/doc/conf.py
- utils/haddock/doc/markup.rst
- + utils/haddock/doc/snippets/.gitignore
- + utils/haddock/doc/snippets/Lists.hs
- + utils/haddock/doc/snippets/Makefile
- + utils/haddock/doc/snippets/Snippet-List-Bulleted.html
- + utils/haddock/doc/snippets/Snippet-List-Bulleted.tex
- + utils/haddock/doc/snippets/Snippet-List-Definition.html
- + utils/haddock/doc/snippets/Snippet-List-Definition.tex
- + utils/haddock/doc/snippets/Snippet-List-Enumerated.html
- + utils/haddock/doc/snippets/Snippet-List-Enumerated.tex
- + utils/haddock/doc/snippets/Snippet-List-Indentation.html
- + utils/haddock/doc/snippets/Snippet-List-Indentation.tex
- + utils/haddock/doc/snippets/Snippet-List-Multiline-Item.html
- + utils/haddock/doc/snippets/Snippet-List-Multiline-Item.tex
- + utils/haddock/doc/snippets/Snippet-List-Nested-Item.html
- + utils/haddock/doc/snippets/Snippet-List-Nested-Item.tex
- + utils/haddock/doc/snippets/Snippet-List-Not-Newline.html
- + utils/haddock/doc/snippets/Snippet-List-Not-Newline.tex
- + utils/haddock/doc/snippets/Snippet-List-Not-Separated.html
- + utils/haddock/doc/snippets/Snippet-List-Not-Separated.tex
- utils/haddock/haddock-api/src/Haddock/Backends/Hoogle.hs
- utils/haddock/haddock-api/src/Haddock/Convert.hs
- utils/haddock/haddock-api/src/Haddock/Interface/LexParseRn.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs
- utils/haddock/haddock-api/src/Haddock/Types.hs
- utils/haddock/html-test/ref/A.html
- utils/haddock/html-test/ref/Bug1004.html
- utils/haddock/html-test/ref/Bug1033.html
- utils/haddock/html-test/ref/Bug1103.html
- utils/haddock/html-test/ref/Bug548.html
- utils/haddock/html-test/ref/Bug923.html
- utils/haddock/html-test/ref/ConstructorPatternExport.html
- utils/haddock/html-test/ref/FunArgs.html
- utils/haddock/html-test/ref/Hash.html
- utils/haddock/html-test/ref/Instances.html
- utils/haddock/html-test/ref/LinearTypes.html
- utils/haddock/html-test/ref/RedactTypeSynonyms.html
- utils/haddock/html-test/ref/T23616.html
- utils/haddock/html-test/ref/Test.html
- utils/haddock/html-test/ref/TypeFamilies3.html
- utils/jsffi/dyld.mjs
- utils/jsffi/post-link.mjs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/992f6b5ed897a5aabc190583eca4bb…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/992f6b5ed897a5aabc190583eca4bb…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/T26930] 6 commits: Add optional `SrcLoc` to `StackAnnotation` class
by Teo Camarasu (@teo) 24 Feb '26
by Teo Camarasu (@teo) 24 Feb '26
24 Feb '26
Teo Camarasu pushed to branch wip/T26930 at Glasgow Haskell Compiler / GHC
Commits:
4c40df3d by fendor at 2026-02-20T10:24:48-05:00
Add optional `SrcLoc` to `StackAnnotation` class
`StackAnnotation`s give access to an optional `SrcLoc` field that
user-added stack annotations can use to provide better backtraces in both error
messages and when decoding the callstack.
We update builtin stack annotations such as `StringAnnotation` and
`ShowAnnotation` to also capture the `SrcLoc` of the current `CallStack`
to improve backtraces by default (if stack annotations are used).
This change is backwards compatible with GHC 9.14.1.
- - - - -
fd9aaa28 by Simon Hengel at 2026-02-20T10:25:33-05:00
docs: Fix grammar in explicit_namespaces.rst
- - - - -
44354255 by Vo Minh Thu at 2026-02-20T18:53:06-05:00
GHCi: add a :version command.
This looks like:
ghci> :version
GHCi, version 9.11.20240322
This closes #24576.
Co-Author: Markus Läll <markus.l2ll(a)gmail.com>
- - - - -
eab3dbba by Andreas Klebinger at 2026-02-20T18:53:51-05:00
hadrian/build-cabal: Better respect and utilize -j
* We now respect -j<n> for the cabal invocation to build hadrian rather
than hardcoding -j
* We use the --semaphore flag to ensure cabal/ghc build the hadrian
executable in parallel using the -jsem mechanism.
Saves 10-15s on fresh builds for me.
Fixes #26876
- - - - -
1161b9ef by Teo Camarasu at 2026-02-23T22:39:03+00:00
ghc-internal: avoid depending on GHC.Internal.Control.Monad.Fix
This module contains the definition of MonadFix, since we want an
instance for IO, that instance requires a lot of machinery and we want
to avoid an orphan instance, this will naturally be quite high up in the
dependency graph.
So we want to avoid other modules depending on it as far as possible.
On Windows, the IO manager depends on the RTSFlags type, which
transtively depends on MonadFix. We refactor things to avoid this
dependency, which would have caused a regression.
Resolves #26875
Metric Decrease:
T12227
- - - - -
42ef67b2 by Teo Camarasu at 2026-02-24T10:24:14+00:00
ghc-internal: float Generics to top of module graph
GHC.Internal.Generics currently exists in the middle of the ghc-internal module graph.
It defines the Generics typeclass. Stuff below it gets an instance in GHC.Internal.Generics whereas stuff above it gets instances in their own modules.
This splits the module graph in two and adds a lot of transitive dependencies to stuff above it.
It also leads to a hs-boot loop via ByteOrder
Resolves #26930
- - - - -
59 changed files:
- compiler/GHC/Builtin/Names.hs
- + docs/users_guide/10.0.1-notes.rst
- docs/users_guide/exts/explicit_namespaces.rst
- docs/users_guide/ghci.rst
- ghc/GHCi/UI.hs
- hadrian/build-cabal
- libraries/base/src/Control/Arrow.hs
- libraries/base/src/System/IO.hs
- libraries/ghc-experimental/CHANGELOG.md
- libraries/ghc-experimental/src/GHC/Stack/Annotation/Experimental.hs
- + libraries/ghc-experimental/tests/Makefile
- + libraries/ghc-experimental/tests/all.T
- + libraries/ghc-experimental/tests/backtraces/Makefile
- + libraries/ghc-experimental/tests/backtraces/T26806a.hs
- + libraries/ghc-experimental/tests/backtraces/T26806a.stderr
- + libraries/ghc-experimental/tests/backtraces/T26806b.hs
- + libraries/ghc-experimental/tests/backtraces/T26806b.stderr
- + libraries/ghc-experimental/tests/backtraces/T26806c.hs
- + libraries/ghc-experimental/tests/backtraces/T26806c.stderr
- + libraries/ghc-experimental/tests/backtraces/all.T
- libraries/ghc-internal/src/GHC/Internal/ByteOrder.hs
- − libraries/ghc-internal/src/GHC/Internal/ByteOrder.hs-boot
- libraries/ghc-internal/src/GHC/Internal/Control/Arrow.hs
- libraries/ghc-internal/src/GHC/Internal/Control/Monad/Fix.hs
- libraries/ghc-internal/src/GHC/Internal/Control/Monad/ST/Lazy/Imp.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Foldable.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Functor/Const.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Functor/Identity.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Monoid.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Semigroup/Internal.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/ManagedThreadPool.hs
- libraries/ghc-internal/src/GHC/Internal/Functor/ZipList.hs
- libraries/ghc-internal/src/GHC/Internal/Generics.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Exception.hs
- libraries/ghc-internal/src/GHC/Internal/RTS/Flags/Test.hsc
- libraries/ghc-internal/src/GHC/Internal/Read.hs
- libraries/ghc-internal/src/GHC/Internal/Stack/Annotation.hs
- libraries/ghc-internal/src/GHC/Internal/System/IO.hs
- libraries/ghc-internal/src/GHC/Internal/TH/Monad.hs
- libraries/ghc-internal/src/GHC/Internal/Unicode/Bits.hs
- libraries/ghc-internal/tests/stack-annotation/ann_frame001.stdout
- libraries/ghc-internal/tests/stack-annotation/ann_frame002.stdout
- libraries/ghc-internal/tests/stack-annotation/ann_frame003.stdout
- libraries/ghc-internal/tests/stack-annotation/ann_frame004.stdout
- libraries/ghc-internal/tests/stack-annotation/ann_frame005.stdout
- testsuite/tests/ghci/scripts/ListTuplePunsPpr.stdout
- testsuite/tests/ghci/scripts/T10963.stderr
- testsuite/tests/ghci/scripts/T4175.stdout
- testsuite/tests/ghci/scripts/ghci064.stdout
- 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/template-haskell-exports.stdout
- testsuite/tests/mdo/should_fail/mdofail006.stderr
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7c937f7d9c993257d6aff609bf2f80…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/7c937f7d9c993257d6aff609bf2f80…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 4 commits: GHCi: add a :version command.
by Marge Bot (@marge-bot) 24 Feb '26
by Marge Bot (@marge-bot) 24 Feb '26
24 Feb '26
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
44354255 by Vo Minh Thu at 2026-02-20T18:53:06-05:00
GHCi: add a :version command.
This looks like:
ghci> :version
GHCi, version 9.11.20240322
This closes #24576.
Co-Author: Markus Läll <markus.l2ll(a)gmail.com>
- - - - -
eab3dbba by Andreas Klebinger at 2026-02-20T18:53:51-05:00
hadrian/build-cabal: Better respect and utilize -j
* We now respect -j<n> for the cabal invocation to build hadrian rather
than hardcoding -j
* We use the --semaphore flag to ensure cabal/ghc build the hadrian
executable in parallel using the -jsem mechanism.
Saves 10-15s on fresh builds for me.
Fixes #26876
- - - - -
25049e92 by Teo Camarasu at 2026-02-24T05:05:40-05:00
ghc-internal: avoid depending on GHC.Internal.Control.Monad.Fix
This module contains the definition of MonadFix, since we want an
instance for IO, that instance requires a lot of machinery and we want
to avoid an orphan instance, this will naturally be quite high up in the
dependency graph.
So we want to avoid other modules depending on it as far as possible.
On Windows, the IO manager depends on the RTSFlags type, which
transtively depends on MonadFix. We refactor things to avoid this
dependency, which would have caused a regression.
Resolves #26875
Metric Decrease:
T12227
- - - - -
ff34fd17 by Wolfgang Jeltsch at 2026-02-24T05:05:40-05:00
Refine the imports of `System.IO.OS`
Commit 68bd08055594b8cbf6148a72d108786deb6c12a1 replaced the
`GHC.Internal.Data.Bool` import by a `GHC.Internal.Base` import.
However, while the `GHC.Internal.Data.Bool` import was conditional and
partial, the `GHC.Internal.Base` import is unconditional and total. As a
result, the import list is not tuned to import only the necessary bits
anymore, and furthermore GHC emits a lot of warnings about redundant
imports.
This commit makes the `GHC.Internal.Base` import conditional and partial
in the same way that the `GHC.Internal.Data.Bool` import was.
- - - - -
25 changed files:
- compiler/GHC/Builtin/Names.hs
- + docs/users_guide/10.0.1-notes.rst
- docs/users_guide/ghci.rst
- ghc/GHCi/UI.hs
- hadrian/build-cabal
- libraries/base/src/Control/Arrow.hs
- libraries/base/src/System/IO.hs
- libraries/ghc-internal/src/GHC/Internal/Control/Arrow.hs
- libraries/ghc-internal/src/GHC/Internal/Control/Monad/Fix.hs
- libraries/ghc-internal/src/GHC/Internal/Control/Monad/ST/Lazy/Imp.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Functor/Identity.hs
- libraries/ghc-internal/src/GHC/Internal/Event/Windows/ManagedThreadPool.hs
- libraries/ghc-internal/src/GHC/Internal/RTS/Flags/Test.hsc
- libraries/ghc-internal/src/GHC/Internal/System/IO.hs
- libraries/ghc-internal/src/GHC/Internal/System/IO/OS.hs
- libraries/ghc-internal/src/GHC/Internal/TH/Monad.hs
- testsuite/tests/ghci/scripts/ListTuplePunsPpr.stdout
- testsuite/tests/ghci/scripts/T10963.stderr
- testsuite/tests/ghci/scripts/T4175.stdout
- 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/template-haskell-exports.stdout
- testsuite/tests/mdo/should_fail/mdofail006.stderr
Changes:
=====================================
compiler/GHC/Builtin/Names.hs
=====================================
@@ -1489,7 +1489,9 @@ composeAName = varQual gHC_INTERNAL_DESUGAR (fsLit ">>>") composeAIdKey
firstAName = varQual gHC_INTERNAL_ARROW (fsLit "first") firstAIdKey
appAName = varQual gHC_INTERNAL_ARROW (fsLit "app") appAIdKey
choiceAName = varQual gHC_INTERNAL_ARROW (fsLit "|||") choiceAIdKey
-loopAName = varQual gHC_INTERNAL_ARROW (fsLit "loop") loopAIdKey
+-- This is defined in Monad.Fix to flatten the module hierarchy of `ghc-internal`
+-- It is the only thing from Control.Arrow that requires MonadFix
+loopAName = varQual gHC_INTERNAL_MONAD_FIX (fsLit "loop") loopAIdKey
-- Monad comprehensions
guardMName, mzipName :: Name
=====================================
docs/users_guide/10.0.1-notes.rst
=====================================
@@ -0,0 +1,36 @@
+.. _release-10-0-1:
+
+Version 10.0.1
+==============
+
+Language
+~~~~~~~~
+
+Compiler
+~~~~~~~~
+
+GHCi
+~~~~
+
+- Added the :ghci-cmd:`:version` command. This displays the current GHC version.
+
+Runtime system
+~~~~~~~~~~~~~~
+
+``base`` library
+~~~~~~~~~~~~~~~~
+
+``ghc-prim`` library
+~~~~~~~~~~~~~~~~~~~~
+
+``ghc`` library
+~~~~~~~~~~~~~~~
+
+``ghc-heap`` library
+~~~~~~~~~~~~~~~~~~~~
+
+``template-haskell`` library
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Included libraries
+~~~~~~~~~~~~~~~~~~
=====================================
docs/users_guide/ghci.rst
=====================================
@@ -3140,6 +3140,10 @@ commonly used commands.
The :ghci-cmd:`:uses` command requires :ghci-cmd:`:set +c` to be set.
+.. ghci-cmd:: :version
+
+ Display the current GHC version.
+
.. ghci-cmd:: :where
Show the current evaluation stack while stopped at a breakpoint.
=====================================
ghc/GHCi/UI.hs
=====================================
@@ -193,9 +193,11 @@ defaultGhciSettings =
fullHelpText = defFullHelpText
}
+versionString :: String
+versionString = "GHCi, version " ++ cProjectVersion
+
ghciWelcomeMsg :: String
-ghciWelcomeMsg = "GHCi, version " ++ cProjectVersion ++
- ": https://www.haskell.org/ghc/ :? for help"
+ghciWelcomeMsg = versionString ++ ": https://www.haskell.org/ghc/ :? for help"
ghciCommands :: [Command]
ghciCommands = map mkCmd [
@@ -253,6 +255,7 @@ ghciCommands = map mkCmd [
("unadd", keepGoingPaths unAddModule, completeFilename),
("undef", keepGoing undefineMacro, completeMacro),
("unset", keepGoing unsetOptions, completeSetOptions),
+ ("version", keepGoing showVersion', noCompletion),
("where", keepGoing whereCmd, noCompletion),
("instances", keepGoing' instancesCmd, completeExpression)
] ++ map mkCmdHidden [ -- hidden commands
@@ -366,6 +369,7 @@ defFullHelpText =
" :type +d <expr> show the type of <expr>, defaulting type variables\n" ++
" :unadd <module> ... remove module(s) from the current target set\n" ++
" :undef <cmd> undefine user-defined command :<cmd>\n" ++
+ " :version display the current GHC version\n" ++
" ::<cmd> run the builtin command\n" ++
" :!<command> run the shell command <command>\n" ++
" :shell <command> run shell via sh -c <command>\n" ++
@@ -3626,6 +3630,9 @@ unsetOptions str
no_flags <- mapM no_flag minus_opts
when (not (null no_flags)) $ newDynFlags False no_flags
+showVersion' :: GhciMonad m => String -> m ()
+showVersion' _ = liftIO (putStrLn versionString)
+
isMinus :: String -> Bool
isMinus ('-':_) = True
isMinus _ = False
=====================================
hadrian/build-cabal
=====================================
@@ -23,9 +23,52 @@ fi
CABVERSTR=$("$CABAL" --numeric-version)
CABVER=( ${CABVERSTR//./ } )
+THREADS="-j1"
+GC_THREADS=""
+SEMAPHORE=""
+
+echo "$@"
+
+# Try building hadrian in parallel. We check for -j<n>.
+# If threads > 1 we pass --semaphore to allow ghc to build more than one module in parallel
+# If threads > 4 we pass -qn as higher parallel gc thread counts can lead to slow downs
+# We only do any of thise for cabal >= 3.14, because I don't trust older versions to handle --semaphore right
+if [ "${CABVER[0]}" -gt 3 ] || [ "${CABVER[0]}" -eq 3 -a "${CABVER[1]}" -ge 14 ];
+then
+
+ for arg in "$@"; do
+ case "$arg" in
+ -j)
+ GC_THREADS="-qn4"
+ SEMAPHORE="--semaphore"
+ THREADS="-j"
+ ;;
+ -j[0-9]*)
+ threads="${arg#-j}"
+ if [[ "$threads" =~ ^[0-9]+$ ]] && [ "$threads" -ne 0 ]; then
+ THREADS="-j${threads}"
+ if [ $threads -ge 4 ]; then
+ GC_THREADS="-qn4"
+ fi
+ if [ $threads -gt 1 ]; then
+ SEMAPHORE="--semaphore"
+ fi
+ fi
+ ;;
+ esac
+
+ done
+
+fi
+
+if [ "$(uname -s)" = "FreeBSD" ]; then
+ # Can't rely on posix semaphore support in free bsd.
+ SEMAPHORE=""
+fi
+
if [ "${CABVER[0]}" -gt 2 -o "${CABVER[0]}" -eq 2 -a "${CABVER[1]}" -ge 2 ];
then
- "$CABAL" --project-file="$PROJ" new-build "${CABFLAGS[@]}" -j exe:hadrian
+ "$CABAL" --project-file="$PROJ" new-build "${CABFLAGS[@]}" ${THREADS} ${SEMAPHORE} --ghc-options="+RTS ${GC_THREADS} -RTS" exe:hadrian
# use new-exec instead of new-run to make sure that the build-tools (alex & happy) are in PATH
"$CABAL" --project-file="$PROJ" new-exec "${CABFLAGS[@]}" hadrian -- \
--directory "$PWD" \
=====================================
libraries/base/src/Control/Arrow.hs
=====================================
@@ -50,3 +50,4 @@ module Control.Arrow
) where
import GHC.Internal.Control.Arrow
+import GHC.Internal.Control.Monad.Fix (ArrowLoop(..))
=====================================
libraries/base/src/System/IO.hs
=====================================
@@ -185,6 +185,7 @@ module System.IO
) where
import GHC.Internal.System.IO
+import GHC.Internal.Control.Monad.Fix (fixIO)
-- $locking
-- Implementations should enforce as far as possible, at least locally to the
=====================================
libraries/ghc-internal/src/GHC/Internal/Control/Arrow.hs
=====================================
@@ -45,13 +45,10 @@ module GHC.Internal.Control.Arrow (
ArrowChoice(..),
-- * Arrow application
ArrowApply(..), ArrowMonad(..), leftApp,
- -- * Feedback
- ArrowLoop(..)
) where
-import GHC.Internal.Data.Tuple ( fst, snd, uncurry )
+import GHC.Internal.Data.Tuple ( uncurry )
import GHC.Internal.Data.Either
-import GHC.Internal.Control.Monad.Fix
import GHC.Internal.Control.Category
import GHC.Internal.Base hiding ( (.), id )
import GHC.Internal.Generics (Generic, Generic1)
@@ -419,55 +416,3 @@ leftApp :: ArrowApply a => a b c -> a (Either b d) (Either c d)
leftApp f = arr ((\b -> (arr (\() -> b) >>> f >>> arr Left, ())) |||
(\d -> (arr (\() -> d) >>> arr Right, ()))) >>> app
--- | The 'loop' operator expresses computations in which an output value
--- is fed back as input, although the computation occurs only once.
--- It underlies the @rec@ value recursion construct in arrow notation.
--- 'loop' should satisfy the following laws:
---
--- [/extension/]
--- @'loop' ('arr' f) = 'arr' (\\ b -> 'fst' ('fix' (\\ (c,d) -> f (b,d))))@
---
--- [/left tightening/]
--- @'loop' ('first' h >>> f) = h >>> 'loop' f@
---
--- [/right tightening/]
--- @'loop' (f >>> 'first' h) = 'loop' f >>> h@
---
--- [/sliding/]
--- @'loop' (f >>> 'arr' ('id' *** k)) = 'loop' ('arr' ('id' *** k) >>> f)@
---
--- [/vanishing/]
--- @'loop' ('loop' f) = 'loop' ('arr' unassoc >>> f >>> 'arr' assoc)@
---
--- [/superposing/]
--- @'second' ('loop' f) = 'loop' ('arr' assoc >>> 'second' f >>> 'arr' unassoc)@
---
--- where
---
--- > assoc ((a,b),c) = (a,(b,c))
--- > unassoc (a,(b,c)) = ((a,b),c)
---
-class Arrow a => ArrowLoop a where
- -- |
- --
- -- > ╭──────────────╮
- -- > b │ ╭───╮ │ c
- -- > >───┼─────┤ ├────┼───>
- -- > │ ┌─┤ ├─┐ │
- -- > │ d │ ╰───╯ │ │
- -- > │ └───<───┘ │
- -- > ╰──────────────╯
- loop :: a (b,d) (c,d) -> a b c
-
--- | @since base-2.01
-instance ArrowLoop (->) where
- loop f b = let (c,d) = f (b,d) in c
-
--- | Beware that for many monads (those for which the '>>=' operation
--- is strict) this instance will /not/ satisfy the right-tightening law
--- required by the 'ArrowLoop' class.
---
--- @since base-2.01
-instance MonadFix m => ArrowLoop (Kleisli m) where
- loop (Kleisli f) = Kleisli (liftM fst . mfix . f')
- where f' x y = f (x, snd y)
=====================================
libraries/ghc-internal/src/GHC/Internal/Control/Monad/Fix.hs
=====================================
@@ -24,7 +24,10 @@
module GHC.Internal.Control.Monad.Fix (
MonadFix(mfix),
- fix
+ fix,
+ fixIO,
+ -- * Feedback for Arrow
+ ArrowLoop(..)
) where
import GHC.Internal.Data.Either
@@ -34,12 +37,19 @@ 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.Data.Tuple ( Solo(..), fst, snd )
+import GHC.Internal.Base ( IO, Monad, errorWithoutStackTrace, (.), return, liftM )
import GHC.Internal.Generics
import GHC.Internal.List ( head, drop )
import GHC.Internal.Control.Monad.ST.Imp
-import GHC.Internal.System.IO
+import qualified GHC.Internal.Control.Monad.ST.Lazy.Imp as Lazy
+import GHC.Internal.Data.Functor.Identity (Identity(..))
+import GHC.Internal.MVar
+import GHC.Internal.IO.Unsafe
+import GHC.Internal.IO.Exception
+import GHC.Internal.TH.Monad
+import GHC.Internal.Control.Exception
+import GHC.Internal.Control.Arrow
-- | Monads having fixed points with a \'knot-tying\' semantics.
-- Instances of 'MonadFix' should satisfy the following laws:
@@ -102,6 +112,86 @@ instance MonadFix NonEmpty where
instance MonadFix IO where
mfix = fixIO
+-- ---------------------------------------------------------------------------
+-- fixIO
+
+-- | The implementation of 'Control.Monad.Fix.mfix' for 'IO'.
+--
+-- This operation may fail with:
+--
+-- * 'FixIOException' if the function passed to 'fixIO' inspects its argument.
+--
+-- ==== __Examples__
+--
+-- the IO-action is only executed once. The recursion is only on the values.
+--
+-- >>> take 3 <$> fixIO (\x -> putStr ":D" >> (:x) <$> readLn @Int)
+-- :D
+-- 2
+-- [2,2,2]
+--
+-- If we are strict in the value, just as with 'Data.Function.fix', we do not get termination:
+--
+-- >>> fixIO (\x -> putStr x >> pure ('x' : x))
+-- * hangs forever *
+--
+-- We can tie the knot of a structure within 'IO' using 'fixIO':
+--
+-- @
+-- data Node = MkNode Int (IORef Node)
+--
+-- foo :: IO ()
+-- foo = do
+-- p \<- fixIO (\p -> newIORef (MkNode 0 p))
+-- q <- output p
+-- r <- output q
+-- _ <- output r
+-- pure ()
+--
+-- output :: IORef Node -> IO (IORef Node)
+-- output ref = do
+-- MkNode x p <- readIORef ref
+-- print x
+-- pure p
+-- @
+--
+-- >>> foo
+-- 0
+-- 0
+-- 0
+fixIO :: (a -> IO a) -> IO a
+fixIO k = do
+ m <- newEmptyMVar
+ ans <- unsafeDupableInterleaveIO
+ (readMVar m `catch` \BlockedIndefinitelyOnMVar ->
+ throwIO FixIOException)
+ result <- k ans
+ putMVar m result
+ return result
+
+-- Note [Blackholing in fixIO]
+-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-- We do our own explicit black holing here, because GHC's lazy
+-- blackholing isn't enough. In an infinite loop, GHC may run the IO
+-- computation a few times before it notices the loop, which is wrong.
+--
+-- NOTE2: the explicit black-holing with an IORef ran into trouble
+-- with multiple threads (see #5421), so now we use an MVar. We used
+-- to use takeMVar with unsafeInterleaveIO. This, however, uses noDuplicate#,
+-- which is not particularly cheap. Better to use readMVar, which can be
+-- performed in multiple threads safely, and to use unsafeDupableInterleaveIO
+-- to avoid the noDuplicate cost.
+--
+-- What we'd ideally want is probably an IVar, but we don't quite have those.
+-- STM TVars look like an option at first, but I don't think they are:
+-- we'd need to be able to write to the variable in an IO context, which can
+-- only be done using 'atomically', and 'atomically' is not allowed within
+-- unsafePerformIO. We can't know if someone will try to use the result
+-- of fixIO with unsafePerformIO!
+--
+-- See also System.IO.Unsafe.unsafeFixIO.
+--
+
-- | @since base-2.01
instance MonadFix ((->) r) where
mfix f = \ r -> let a = f a r in a
@@ -116,6 +206,10 @@ instance MonadFix (Either e) where
instance MonadFix (ST s) where
mfix = fixST
+-- | @since base-2.01
+instance MonadFix (Lazy.ST s) where
+ mfix = Lazy.fixST
+
-- Instances of Data.Monoid wrappers
-- | @since base-4.8.0.0
@@ -171,3 +265,77 @@ instance (MonadFix f, MonadFix g) => MonadFix (f :*: g) where
-- | @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))
+
+-- | If the function passed to 'mfix' inspects its argument,
+-- the resulting action will throw a 'FixIOException'.
+--
+-- @since 2.17.0.0
+instance MonadFix Q where
+ -- We use the same blackholing approach as in fixIO.
+ -- See Note [Blackholing in fixIO].
+ mfix k = do
+ m <- runIO newEmptyMVar
+ ans <- runIO (unsafeDupableInterleaveIO
+ (readMVar m `catch` \BlockedIndefinitelyOnMVar ->
+ throwIO FixIOException))
+ result <- k ans
+ runIO (putMVar m result)
+ return result
+
+-- | The 'loop' operator expresses computations in which an output value
+-- is fed back as input, although the computation occurs only once.
+-- It underlies the @rec@ value recursion construct in arrow notation.
+-- 'loop' should satisfy the following laws:
+--
+-- [/extension/]
+-- @'loop' ('arr' f) = 'arr' (\\ b -> 'fst' ('fix' (\\ (c,d) -> f (b,d))))@
+--
+-- [/left tightening/]
+-- @'loop' ('first' h >>> f) = h >>> 'loop' f@
+--
+-- [/right tightening/]
+-- @'loop' (f >>> 'first' h) = 'loop' f >>> h@
+--
+-- [/sliding/]
+-- @'loop' (f >>> 'arr' ('id' *** k)) = 'loop' ('arr' ('id' *** k) >>> f)@
+--
+-- [/vanishing/]
+-- @'loop' ('loop' f) = 'loop' ('arr' unassoc >>> f >>> 'arr' assoc)@
+--
+-- [/superposing/]
+-- @'second' ('loop' f) = 'loop' ('arr' assoc >>> 'second' f >>> 'arr' unassoc)@
+--
+-- where
+--
+-- > assoc ((a,b),c) = (a,(b,c))
+-- > unassoc (a,(b,c)) = ((a,b),c)
+--
+class Arrow a => ArrowLoop a where
+ -- |
+ --
+ -- > ╭──────────────╮
+ -- > b │ ╭───╮ │ c
+ -- > >───┼─────┤ ├────┼───>
+ -- > │ ┌─┤ ├─┐ │
+ -- > │ d │ ╰───╯ │ │
+ -- > │ └───<───┘ │
+ -- > ╰──────────────╯
+ loop :: a (b,d) (c,d) -> a b c
+
+-- | @since base-2.01
+instance ArrowLoop (->) where
+ loop f b = let (c,d) = f (b,d) in c
+
+-- | Beware that for many monads (those for which the '>>=' operation
+-- is strict) this instance will /not/ satisfy the right-tightening law
+-- required by the 'ArrowLoop' class.
+--
+-- @since base-2.01
+instance MonadFix m => ArrowLoop (Kleisli m) where
+ loop (Kleisli f) = Kleisli (liftM fst . mfix . f')
+ where f' x y = f (x, snd y)
=====================================
libraries/ghc-internal/src/GHC/Internal/Control/Monad/ST/Lazy/Imp.hs
=====================================
@@ -37,7 +37,6 @@ module GHC.Internal.Control.Monad.ST.Lazy.Imp (
unsafeIOToST
) where
-import GHC.Internal.Control.Monad.Fix
import GHC.Internal.Data.Tuple
import qualified GHC.Internal.Control.Monad.ST.Imp as ST
@@ -210,10 +209,6 @@ fixST m = ST (\ s ->
-- itself is demanded directly in the `let` body. See also
-- Note [Lazy ST: not producing lazy pairs].
--- | @since base-2.01
-instance MonadFix (ST s) where
- mfix = fixST
-
-- | @since base-4.23.0.0
instance Semigroup a => Semigroup (ST s a) where
(<>) = liftA2 (<>)
=====================================
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/Event/Windows/ManagedThreadPool.hs
=====================================
@@ -35,7 +35,7 @@ import GHC.Internal.Real (fromIntegral)
import qualified GHC.Internal.Event.Array as A
import GHC.Internal.IO.Handle.Internals (debugIO)
import GHC.Internal.Conc.Sync (ThreadId(..))
-import GHC.Internal.RTS.Flags
+import GHC.Internal.RTS.Flags.Test
------------------------------------------------------------------------
-- Thread spool manager
@@ -60,7 +60,7 @@ startThreadPool job = do
let thrMinThreads = 2
let thrCurThreads = 0
let thrCallBack = job
- thrMaxThreads <- (fromIntegral . numIoWorkerThreads) `fmap` getMiscFlags
+ thrMaxThreads <- getNumIoWorkerThreads
thrActiveThreads <- newMVar 0
thrMonitor <- newEmptyMVar
thrThreadIds <- undefined -- A.new thrMaxThreads
=====================================
libraries/ghc-internal/src/GHC/Internal/RTS/Flags/Test.hsc
=====================================
@@ -4,24 +4,23 @@
-- that allows to quickly test if some flag is set.
module GHC.Internal.RTS.Flags.Test
( getUserEventTracingEnabled
+ , getNumIoWorkerThreads
)
where
import GHC.Internal.Base
-
-#if !defined(javascript_HOST_ARCH)
-
import GHC.Internal.Ptr
import GHC.Internal.Foreign.C.Types
import GHC.Internal.Foreign.Marshal.Utils
import GHC.Internal.Foreign.Storable
import GHC.Internal.Data.Functor ((<$>))
+import GHC.Internal.Word (Word32)
+import GHC.Internal.Real (fromIntegral)
#include "Rts.h"
#include "rts/Flags.h"
foreign import ccall "&RtsFlags" rtsFlagsPtr :: Ptr ()
-#endif
-- | Specialized version of 'getTraceFlags' for just checking if user
-- event tracing is enabled.
@@ -34,3 +33,9 @@ getUserEventTracingEnabled = do
let ptr = (#ptr RTS_FLAGS, TraceFlags) rtsFlagsPtr
toBool <$> (#{peek TRACE_FLAGS, user} ptr :: IO CBool)
#endif
+
+-- | Specialized version of 'getMiscFlags' for just checking the number of IO worker threads
+getNumIoWorkerThreads :: IO Int
+getNumIoWorkerThreads = do
+ let ptr = (#ptr RTS_FLAGS, MiscFlags) rtsFlagsPtr
+ fromIntegral <$> (#{peek MISC_FLAGS, numIoWorkerThreads} ptr :: IO Word32)
=====================================
libraries/ghc-internal/src/GHC/Internal/System/IO.hs
=====================================
@@ -20,7 +20,6 @@ module GHC.Internal.System.IO (
-- * The IO monad
IO,
- fixIO,
-- * Files and handles
@@ -258,7 +257,6 @@ import GHC.Internal.IO.Encoding
import GHC.Internal.Text.Read
import GHC.Internal.IO.StdHandles
import GHC.Internal.Show
-import GHC.Internal.MVar
-----------------------------------------------------------------------------
-- Standard IO
@@ -602,87 +600,6 @@ hReady h = hWaitForInput h 0
hPrint :: Show a => Handle -> a -> IO ()
hPrint hdl = hPutStrLn hdl . show
-
--- ---------------------------------------------------------------------------
--- fixIO
-
--- | The implementation of 'Control.Monad.Fix.mfix' for 'IO'.
---
--- This operation may fail with:
---
--- * 'FixIOException' if the function passed to 'fixIO' inspects its argument.
---
--- ==== __Examples__
---
--- the IO-action is only executed once. The recursion is only on the values.
---
--- >>> take 3 <$> fixIO (\x -> putStr ":D" >> (:x) <$> readLn @Int)
--- :D
--- 2
--- [2,2,2]
---
--- If we are strict in the value, just as with 'Data.Function.fix', we do not get termination:
---
--- >>> fixIO (\x -> putStr x >> pure ('x' : x))
--- * hangs forever *
---
--- We can tie the knot of a structure within 'IO' using 'fixIO':
---
--- @
--- data Node = MkNode Int (IORef Node)
---
--- foo :: IO ()
--- foo = do
--- p \<- fixIO (\p -> newIORef (MkNode 0 p))
--- q <- output p
--- r <- output q
--- _ <- output r
--- pure ()
---
--- output :: IORef Node -> IO (IORef Node)
--- output ref = do
--- MkNode x p <- readIORef ref
--- print x
--- pure p
--- @
---
--- >>> foo
--- 0
--- 0
--- 0
-fixIO :: (a -> IO a) -> IO a
-fixIO k = do
- m <- newEmptyMVar
- ans <- unsafeDupableInterleaveIO
- (readMVar m `catch` \BlockedIndefinitelyOnMVar ->
- throwIO FixIOException)
- result <- k ans
- putMVar m result
- return result
-
--- Note [Blackholing in fixIO]
--- ~~~~~~~~~~~~~~~~~~~~~~~~~~~
--- We do our own explicit black holing here, because GHC's lazy
--- blackholing isn't enough. In an infinite loop, GHC may run the IO
--- computation a few times before it notices the loop, which is wrong.
---
--- NOTE2: the explicit black-holing with an IORef ran into trouble
--- with multiple threads (see #5421), so now we use an MVar. We used
--- to use takeMVar with unsafeInterleaveIO. This, however, uses noDuplicate#,
--- which is not particularly cheap. Better to use readMVar, which can be
--- performed in multiple threads safely, and to use unsafeDupableInterleaveIO
--- to avoid the noDuplicate cost.
---
--- What we'd ideally want is probably an IVar, but we don't quite have those.
--- STM TVars look like an option at first, but I don't think they are:
--- we'd need to be able to write to the variable in an IO context, which can
--- only be done using 'atomically', and 'atomically' is not allowed within
--- unsafePerformIO. We can't know if someone will try to use the result
--- of fixIO with unsafePerformIO!
---
--- See also System.IO.Unsafe.unsafeFixIO.
---
-
-- | The function creates a temporary file in ReadWrite mode.
-- The created file isn\'t deleted automatically, so you need to delete it manually.
--
=====================================
libraries/ghc-internal/src/GHC/Internal/System/IO/OS.hs
=====================================
@@ -23,7 +23,9 @@ module GHC.Internal.System.IO.OS
)
where
-import GHC.Internal.Base
+#if defined(mingw32_HOST_OS)
+import GHC.Internal.Base (otherwise)
+#endif
import GHC.Internal.Control.Monad (return)
import GHC.Internal.Control.Concurrent.MVar (MVar)
import GHC.Internal.Control.Exception (mask)
=====================================
libraries/ghc-internal/src/GHC/Internal/TH/Monad.hs
=====================================
@@ -28,13 +28,8 @@ import Data.Data hiding (Fixity(..))
import Data.IORef
import System.IO.Unsafe ( unsafePerformIO )
import Control.Monad.IO.Class (MonadIO (..))
-import Control.Monad.Fix (MonadFix (..))
-import Control.Exception (BlockedIndefinitelyOnMVar (..), catch, throwIO)
-import Control.Exception.Base (FixIOException (..))
-import Control.Concurrent.MVar (newEmptyMVar, readMVar, putMVar)
import System.IO ( hPutStrLn, stderr )
import qualified Data.Kind as Kind (Type)
-import GHC.IO.Unsafe ( unsafeDupableInterleaveIO )
import GHC.Types (TYPE, RuntimeRep(..))
#else
import GHC.Internal.Base hiding (NonEmpty(..),Type, Module, sequence)
@@ -46,12 +41,8 @@ import GHC.Internal.Data.Foldable
import GHC.Internal.Data.Typeable
import GHC.Internal.Control.Monad.IO.Class
import GHC.Internal.Control.Monad.Fail
-import GHC.Internal.Control.Monad.Fix
-import GHC.Internal.Control.Exception
import GHC.Internal.Num
import GHC.Internal.IO.Unsafe
-import GHC.Internal.MVar
-import GHC.Internal.IO.Exception
import qualified GHC.Internal.Types as Kind (Type)
#endif
import GHC.Internal.ForeignSrcLang
@@ -258,22 +249,6 @@ instance Semigroup a => Semigroup (Q a) where
instance Monoid a => Monoid (Q a) where
mempty = pure mempty
--- | If the function passed to 'mfix' inspects its argument,
--- the resulting action will throw a 'FixIOException'.
---
--- @since 2.17.0.0
-instance MonadFix Q where
- -- We use the same blackholing approach as in fixIO.
- -- See Note [Blackholing in fixIO] in System.IO in base.
- mfix k = do
- m <- runIO newEmptyMVar
- ans <- runIO (unsafeDupableInterleaveIO
- (readMVar m `catch` \BlockedIndefinitelyOnMVar ->
- throwIO FixIOException))
- result <- k ans
- runIO (putMVar m result)
- return result
-
-----------------------------------------------------
--
=====================================
testsuite/tests/ghci/scripts/ListTuplePunsPpr.stdout
=====================================
@@ -41,10 +41,10 @@ data Tuple2 a b = (,) a b
-- Defined in ‘GHC.Internal.Tuple’
instance Traversable (Tuple2 a)
-- Defined in ‘GHC.Internal.Data.Traversable’
-instance Foldable (Tuple2 a)
- -- Defined in ‘GHC.Internal.Data.Foldable’
instance Monoid a => Applicative (Tuple2 a)
-- Defined in ‘GHC.Internal.Base’
+instance Foldable (Tuple2 a)
+ -- Defined in ‘GHC.Internal.Data.Foldable’
instance Functor (Tuple2 a) -- Defined in ‘GHC.Internal.Base’
instance Monoid a => Monad (Tuple2 a)
-- Defined in ‘GHC.Internal.Base’
=====================================
testsuite/tests/ghci/scripts/T10963.stderr
=====================================
@@ -1,4 +1,3 @@
-
<interactive>:1:1: error: [GHC-39999]
• Ambiguous type variable ‘a0’ arising from a use of ‘foo’
prevents the constraint ‘(Num a0)’ from being solved.
@@ -10,3 +9,4 @@
...plus one instance involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: foo
+
=====================================
testsuite/tests/ghci/scripts/T4175.stdout
=====================================
@@ -44,8 +44,8 @@ instance Traversable Maybe
-- Defined in ‘GHC.Internal.Data.Traversable’
instance MonadFail Maybe
-- Defined in ‘GHC.Internal.Control.Monad.Fail’
-instance Foldable Maybe -- Defined in ‘GHC.Internal.Data.Foldable’
instance Applicative Maybe -- Defined in ‘GHC.Internal.Base’
+instance Foldable Maybe -- Defined in ‘GHC.Internal.Data.Foldable’
instance Functor Maybe -- Defined in ‘GHC.Internal.Base’
instance Monad Maybe -- Defined in ‘GHC.Internal.Base’
instance Semigroup a => Monoid (Maybe a)
=====================================
testsuite/tests/interface-stability/base-exports.stdout
=====================================
@@ -11527,8 +11527,6 @@ instance GHC.Internal.Control.Arrow.ArrowApply (->) -- Defined in ‘GHC.Interna
instance forall (m :: * -> *). GHC.Internal.Base.Monad m => GHC.Internal.Control.Arrow.ArrowApply (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Arrow’
instance GHC.Internal.Control.Arrow.ArrowChoice (->) -- Defined in ‘GHC.Internal.Control.Arrow’
instance forall (m :: * -> *). GHC.Internal.Base.Monad m => GHC.Internal.Control.Arrow.ArrowChoice (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Arrow’
-instance GHC.Internal.Control.Arrow.ArrowLoop (->) -- Defined in ‘GHC.Internal.Control.Arrow’
-instance forall (m :: * -> *). GHC.Internal.Control.Monad.Fix.MonadFix m => GHC.Internal.Control.Arrow.ArrowLoop (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Arrow’
instance forall (m :: * -> *). GHC.Internal.Base.MonadPlus m => GHC.Internal.Control.Arrow.ArrowPlus (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Arrow’
instance forall (m :: * -> *). GHC.Internal.Base.MonadPlus m => GHC.Internal.Control.Arrow.ArrowZero (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Arrow’
instance forall (m :: * -> *). GHC.Internal.Base.Monad m => GHC.Internal.Control.Category.Category (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Arrow’
@@ -11544,6 +11542,8 @@ instance forall (f :: * -> *). GHC.Internal.Control.Monad.Fail.MonadFail f => GH
instance GHC.Internal.Control.Monad.Fail.MonadFail GHC.Internal.Text.ParserCombinators.ReadP.P -- Defined in ‘GHC.Internal.Text.ParserCombinators.ReadP’
instance GHC.Internal.Control.Monad.Fail.MonadFail GHC.Internal.Text.ParserCombinators.ReadP.ReadP -- Defined in ‘GHC.Internal.Text.ParserCombinators.ReadP’
instance GHC.Internal.Control.Monad.Fail.MonadFail GHC.Internal.Text.ParserCombinators.ReadPrec.ReadPrec -- Defined in ‘GHC.Internal.Text.ParserCombinators.ReadPrec’
+instance GHC.Internal.Control.Monad.Fix.ArrowLoop (->) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
+instance forall (m :: * -> *). GHC.Internal.Control.Monad.Fix.MonadFix m => GHC.Internal.Control.Monad.Fix.ArrowLoop (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall (f :: * -> *) (g :: * -> *). (GHC.Internal.Control.Monad.Fix.MonadFix f, GHC.Internal.Control.Monad.Fix.MonadFix g) => GHC.Internal.Control.Monad.Fix.MonadFix (f GHC.Internal.Generics.:*: g) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall (f :: * -> *). GHC.Internal.Control.Monad.Fix.MonadFix f => GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Data.Semigroup.Internal.Alt f) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall (f :: * -> *). GHC.Internal.Control.Monad.Fix.MonadFix f => GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Data.Monoid.Ap f) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
@@ -11553,6 +11553,7 @@ instance forall e. GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Data.Ei
instance forall r. GHC.Internal.Control.Monad.Fix.MonadFix ((->) r) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Data.Monoid.First -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Types.IO -- Defined in ‘GHC.Internal.Control.Monad.Fix’
+instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Data.Functor.Identity.Identity -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Data.Monoid.Last -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix [] -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall (f :: * -> *) i (c :: GHC.Internal.Generics.Meta). GHC.Internal.Control.Monad.Fix.MonadFix f => GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Generics.M1 i c f) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
@@ -11560,14 +11561,14 @@ instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Maybe.Maybe -- Def
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Base.NonEmpty -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Generics.Par1 -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Data.Semigroup.Internal.Product -- Defined in ‘GHC.Internal.Control.Monad.Fix’
+instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.TH.Monad.Q -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall (f :: * -> *). GHC.Internal.Control.Monad.Fix.MonadFix f => GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Generics.Rec1 f) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
+instance forall s. GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Control.Monad.ST.Lazy.Imp.ST s) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall s. GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.ST.ST s) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix Solo -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Data.Semigroup.Internal.Sum -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall a. GHC.Internal.Base.Monoid a => GHC.Internal.Control.Monad.Fix.MonadFix ((,) a) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
-instance forall s. GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Control.Monad.ST.Lazy.Imp.ST s) -- Defined in ‘GHC.Internal.Control.Monad.ST.Lazy.Imp’
instance GHC.Internal.Control.Monad.Fix.MonadFix Data.Complex.Complex -- Defined in ‘Data.Complex’
-instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Data.Functor.Identity.Identity -- Defined in ‘GHC.Internal.Data.Functor.Identity’
instance [safe] forall (f :: * -> *) (g :: * -> *). (GHC.Internal.Control.Monad.Fix.MonadFix f, GHC.Internal.Control.Monad.Fix.MonadFix g) => GHC.Internal.Control.Monad.Fix.MonadFix (Data.Functor.Product.Product f g) -- Defined in ‘Data.Functor.Product’
instance GHC.Internal.Control.Monad.Fix.MonadFix Data.Semigroup.First -- Defined in ‘Data.Semigroup’
instance GHC.Internal.Control.Monad.Fix.MonadFix Data.Semigroup.Last -- Defined in ‘Data.Semigroup’
=====================================
testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
=====================================
@@ -11554,8 +11554,6 @@ instance GHC.Internal.Control.Arrow.ArrowApply (->) -- Defined in ‘GHC.Interna
instance forall (m :: * -> *). GHC.Internal.Base.Monad m => GHC.Internal.Control.Arrow.ArrowApply (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Arrow’
instance GHC.Internal.Control.Arrow.ArrowChoice (->) -- Defined in ‘GHC.Internal.Control.Arrow’
instance forall (m :: * -> *). GHC.Internal.Base.Monad m => GHC.Internal.Control.Arrow.ArrowChoice (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Arrow’
-instance GHC.Internal.Control.Arrow.ArrowLoop (->) -- Defined in ‘GHC.Internal.Control.Arrow’
-instance forall (m :: * -> *). GHC.Internal.Control.Monad.Fix.MonadFix m => GHC.Internal.Control.Arrow.ArrowLoop (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Arrow’
instance forall (m :: * -> *). GHC.Internal.Base.MonadPlus m => GHC.Internal.Control.Arrow.ArrowPlus (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Arrow’
instance forall (m :: * -> *). GHC.Internal.Base.MonadPlus m => GHC.Internal.Control.Arrow.ArrowZero (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Arrow’
instance forall (m :: * -> *). GHC.Internal.Base.Monad m => GHC.Internal.Control.Category.Category (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Arrow’
@@ -11571,6 +11569,8 @@ instance forall (f :: * -> *). GHC.Internal.Control.Monad.Fail.MonadFail f => GH
instance GHC.Internal.Control.Monad.Fail.MonadFail GHC.Internal.Text.ParserCombinators.ReadP.P -- Defined in ‘GHC.Internal.Text.ParserCombinators.ReadP’
instance GHC.Internal.Control.Monad.Fail.MonadFail GHC.Internal.Text.ParserCombinators.ReadP.ReadP -- Defined in ‘GHC.Internal.Text.ParserCombinators.ReadP’
instance GHC.Internal.Control.Monad.Fail.MonadFail GHC.Internal.Text.ParserCombinators.ReadPrec.ReadPrec -- Defined in ‘GHC.Internal.Text.ParserCombinators.ReadPrec’
+instance GHC.Internal.Control.Monad.Fix.ArrowLoop (->) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
+instance forall (m :: * -> *). GHC.Internal.Control.Monad.Fix.MonadFix m => GHC.Internal.Control.Monad.Fix.ArrowLoop (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall (f :: * -> *) (g :: * -> *). (GHC.Internal.Control.Monad.Fix.MonadFix f, GHC.Internal.Control.Monad.Fix.MonadFix g) => GHC.Internal.Control.Monad.Fix.MonadFix (f GHC.Internal.Generics.:*: g) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall (f :: * -> *). GHC.Internal.Control.Monad.Fix.MonadFix f => GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Data.Semigroup.Internal.Alt f) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall (f :: * -> *). GHC.Internal.Control.Monad.Fix.MonadFix f => GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Data.Monoid.Ap f) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
@@ -11580,6 +11580,7 @@ instance forall e. GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Data.Ei
instance forall r. GHC.Internal.Control.Monad.Fix.MonadFix ((->) r) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Data.Monoid.First -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Types.IO -- Defined in ‘GHC.Internal.Control.Monad.Fix’
+instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Data.Functor.Identity.Identity -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Data.Monoid.Last -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix [] -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall (f :: * -> *) i (c :: GHC.Internal.Generics.Meta). GHC.Internal.Control.Monad.Fix.MonadFix f => GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Generics.M1 i c f) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
@@ -11587,14 +11588,14 @@ instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Maybe.Maybe -- Def
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Base.NonEmpty -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Generics.Par1 -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Data.Semigroup.Internal.Product -- Defined in ‘GHC.Internal.Control.Monad.Fix’
+instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.TH.Monad.Q -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall (f :: * -> *). GHC.Internal.Control.Monad.Fix.MonadFix f => GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Generics.Rec1 f) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
+instance forall s. GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Control.Monad.ST.Lazy.Imp.ST s) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall s. GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.ST.ST s) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix Solo -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Data.Semigroup.Internal.Sum -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall a. GHC.Internal.Base.Monoid a => GHC.Internal.Control.Monad.Fix.MonadFix ((,) a) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
-instance forall s. GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Control.Monad.ST.Lazy.Imp.ST s) -- Defined in ‘GHC.Internal.Control.Monad.ST.Lazy.Imp’
instance GHC.Internal.Control.Monad.Fix.MonadFix Data.Complex.Complex -- Defined in ‘Data.Complex’
-instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Data.Functor.Identity.Identity -- Defined in ‘GHC.Internal.Data.Functor.Identity’
instance [safe] forall (f :: * -> *) (g :: * -> *). (GHC.Internal.Control.Monad.Fix.MonadFix f, GHC.Internal.Control.Monad.Fix.MonadFix g) => GHC.Internal.Control.Monad.Fix.MonadFix (Data.Functor.Product.Product f g) -- Defined in ‘Data.Functor.Product’
instance GHC.Internal.Control.Monad.Fix.MonadFix Data.Semigroup.First -- Defined in ‘Data.Semigroup’
instance GHC.Internal.Control.Monad.Fix.MonadFix Data.Semigroup.Last -- Defined in ‘Data.Semigroup’
=====================================
testsuite/tests/interface-stability/base-exports.stdout-mingw32
=====================================
@@ -11785,8 +11785,6 @@ instance GHC.Internal.Control.Arrow.ArrowApply (->) -- Defined in ‘GHC.Interna
instance forall (m :: * -> *). GHC.Internal.Base.Monad m => GHC.Internal.Control.Arrow.ArrowApply (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Arrow’
instance GHC.Internal.Control.Arrow.ArrowChoice (->) -- Defined in ‘GHC.Internal.Control.Arrow’
instance forall (m :: * -> *). GHC.Internal.Base.Monad m => GHC.Internal.Control.Arrow.ArrowChoice (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Arrow’
-instance GHC.Internal.Control.Arrow.ArrowLoop (->) -- Defined in ‘GHC.Internal.Control.Arrow’
-instance forall (m :: * -> *). GHC.Internal.Control.Monad.Fix.MonadFix m => GHC.Internal.Control.Arrow.ArrowLoop (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Arrow’
instance forall (m :: * -> *). GHC.Internal.Base.MonadPlus m => GHC.Internal.Control.Arrow.ArrowPlus (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Arrow’
instance forall (m :: * -> *). GHC.Internal.Base.MonadPlus m => GHC.Internal.Control.Arrow.ArrowZero (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Arrow’
instance forall (m :: * -> *). GHC.Internal.Base.Monad m => GHC.Internal.Control.Category.Category (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Arrow’
@@ -11802,6 +11800,8 @@ instance forall (f :: * -> *). GHC.Internal.Control.Monad.Fail.MonadFail f => GH
instance GHC.Internal.Control.Monad.Fail.MonadFail GHC.Internal.Text.ParserCombinators.ReadP.P -- Defined in ‘GHC.Internal.Text.ParserCombinators.ReadP’
instance GHC.Internal.Control.Monad.Fail.MonadFail GHC.Internal.Text.ParserCombinators.ReadP.ReadP -- Defined in ‘GHC.Internal.Text.ParserCombinators.ReadP’
instance GHC.Internal.Control.Monad.Fail.MonadFail GHC.Internal.Text.ParserCombinators.ReadPrec.ReadPrec -- Defined in ‘GHC.Internal.Text.ParserCombinators.ReadPrec’
+instance GHC.Internal.Control.Monad.Fix.ArrowLoop (->) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
+instance forall (m :: * -> *). GHC.Internal.Control.Monad.Fix.MonadFix m => GHC.Internal.Control.Monad.Fix.ArrowLoop (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall (f :: * -> *) (g :: * -> *). (GHC.Internal.Control.Monad.Fix.MonadFix f, GHC.Internal.Control.Monad.Fix.MonadFix g) => GHC.Internal.Control.Monad.Fix.MonadFix (f GHC.Internal.Generics.:*: g) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall (f :: * -> *). GHC.Internal.Control.Monad.Fix.MonadFix f => GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Data.Semigroup.Internal.Alt f) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall (f :: * -> *). GHC.Internal.Control.Monad.Fix.MonadFix f => GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Data.Monoid.Ap f) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
@@ -11811,6 +11811,7 @@ instance forall e. GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Data.Ei
instance forall r. GHC.Internal.Control.Monad.Fix.MonadFix ((->) r) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Data.Monoid.First -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Types.IO -- Defined in ‘GHC.Internal.Control.Monad.Fix’
+instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Data.Functor.Identity.Identity -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Data.Monoid.Last -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix [] -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall (f :: * -> *) i (c :: GHC.Internal.Generics.Meta). GHC.Internal.Control.Monad.Fix.MonadFix f => GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Generics.M1 i c f) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
@@ -11818,14 +11819,14 @@ instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Maybe.Maybe -- Def
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Base.NonEmpty -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Generics.Par1 -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Data.Semigroup.Internal.Product -- Defined in ‘GHC.Internal.Control.Monad.Fix’
+instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.TH.Monad.Q -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall (f :: * -> *). GHC.Internal.Control.Monad.Fix.MonadFix f => GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Generics.Rec1 f) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
+instance forall s. GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Control.Monad.ST.Lazy.Imp.ST s) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall s. GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.ST.ST s) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix Solo -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Data.Semigroup.Internal.Sum -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall a. GHC.Internal.Base.Monoid a => GHC.Internal.Control.Monad.Fix.MonadFix ((,) a) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
-instance forall s. GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Control.Monad.ST.Lazy.Imp.ST s) -- Defined in ‘GHC.Internal.Control.Monad.ST.Lazy.Imp’
instance GHC.Internal.Control.Monad.Fix.MonadFix Data.Complex.Complex -- Defined in ‘Data.Complex’
-instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Data.Functor.Identity.Identity -- Defined in ‘GHC.Internal.Data.Functor.Identity’
instance [safe] forall (f :: * -> *) (g :: * -> *). (GHC.Internal.Control.Monad.Fix.MonadFix f, GHC.Internal.Control.Monad.Fix.MonadFix g) => GHC.Internal.Control.Monad.Fix.MonadFix (Data.Functor.Product.Product f g) -- Defined in ‘Data.Functor.Product’
instance GHC.Internal.Control.Monad.Fix.MonadFix Data.Semigroup.First -- Defined in ‘Data.Semigroup’
instance GHC.Internal.Control.Monad.Fix.MonadFix Data.Semigroup.Last -- Defined in ‘Data.Semigroup’
=====================================
testsuite/tests/interface-stability/base-exports.stdout-ws-32
=====================================
@@ -11527,8 +11527,6 @@ instance GHC.Internal.Control.Arrow.ArrowApply (->) -- Defined in ‘GHC.Interna
instance forall (m :: * -> *). GHC.Internal.Base.Monad m => GHC.Internal.Control.Arrow.ArrowApply (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Arrow’
instance GHC.Internal.Control.Arrow.ArrowChoice (->) -- Defined in ‘GHC.Internal.Control.Arrow’
instance forall (m :: * -> *). GHC.Internal.Base.Monad m => GHC.Internal.Control.Arrow.ArrowChoice (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Arrow’
-instance GHC.Internal.Control.Arrow.ArrowLoop (->) -- Defined in ‘GHC.Internal.Control.Arrow’
-instance forall (m :: * -> *). GHC.Internal.Control.Monad.Fix.MonadFix m => GHC.Internal.Control.Arrow.ArrowLoop (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Arrow’
instance forall (m :: * -> *). GHC.Internal.Base.MonadPlus m => GHC.Internal.Control.Arrow.ArrowPlus (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Arrow’
instance forall (m :: * -> *). GHC.Internal.Base.MonadPlus m => GHC.Internal.Control.Arrow.ArrowZero (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Arrow’
instance forall (m :: * -> *). GHC.Internal.Base.Monad m => GHC.Internal.Control.Category.Category (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Arrow’
@@ -11544,6 +11542,8 @@ instance forall (f :: * -> *). GHC.Internal.Control.Monad.Fail.MonadFail f => GH
instance GHC.Internal.Control.Monad.Fail.MonadFail GHC.Internal.Text.ParserCombinators.ReadP.P -- Defined in ‘GHC.Internal.Text.ParserCombinators.ReadP’
instance GHC.Internal.Control.Monad.Fail.MonadFail GHC.Internal.Text.ParserCombinators.ReadP.ReadP -- Defined in ‘GHC.Internal.Text.ParserCombinators.ReadP’
instance GHC.Internal.Control.Monad.Fail.MonadFail GHC.Internal.Text.ParserCombinators.ReadPrec.ReadPrec -- Defined in ‘GHC.Internal.Text.ParserCombinators.ReadPrec’
+instance GHC.Internal.Control.Monad.Fix.ArrowLoop (->) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
+instance forall (m :: * -> *). GHC.Internal.Control.Monad.Fix.MonadFix m => GHC.Internal.Control.Monad.Fix.ArrowLoop (GHC.Internal.Control.Arrow.Kleisli m) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall (f :: * -> *) (g :: * -> *). (GHC.Internal.Control.Monad.Fix.MonadFix f, GHC.Internal.Control.Monad.Fix.MonadFix g) => GHC.Internal.Control.Monad.Fix.MonadFix (f GHC.Internal.Generics.:*: g) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall (f :: * -> *). GHC.Internal.Control.Monad.Fix.MonadFix f => GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Data.Semigroup.Internal.Alt f) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall (f :: * -> *). GHC.Internal.Control.Monad.Fix.MonadFix f => GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Data.Monoid.Ap f) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
@@ -11553,6 +11553,7 @@ instance forall e. GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Data.Ei
instance forall r. GHC.Internal.Control.Monad.Fix.MonadFix ((->) r) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Data.Monoid.First -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Types.IO -- Defined in ‘GHC.Internal.Control.Monad.Fix’
+instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Data.Functor.Identity.Identity -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Data.Monoid.Last -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix [] -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall (f :: * -> *) i (c :: GHC.Internal.Generics.Meta). GHC.Internal.Control.Monad.Fix.MonadFix f => GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Generics.M1 i c f) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
@@ -11560,14 +11561,14 @@ instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Maybe.Maybe -- Def
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Base.NonEmpty -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Generics.Par1 -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Data.Semigroup.Internal.Product -- Defined in ‘GHC.Internal.Control.Monad.Fix’
+instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.TH.Monad.Q -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall (f :: * -> *). GHC.Internal.Control.Monad.Fix.MonadFix f => GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Generics.Rec1 f) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
+instance forall s. GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Control.Monad.ST.Lazy.Imp.ST s) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall s. GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.ST.ST s) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix Solo -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Data.Semigroup.Internal.Sum -- Defined in ‘GHC.Internal.Control.Monad.Fix’
instance forall a. GHC.Internal.Base.Monoid a => GHC.Internal.Control.Monad.Fix.MonadFix ((,) a) -- Defined in ‘GHC.Internal.Control.Monad.Fix’
-instance forall s. GHC.Internal.Control.Monad.Fix.MonadFix (GHC.Internal.Control.Monad.ST.Lazy.Imp.ST s) -- Defined in ‘GHC.Internal.Control.Monad.ST.Lazy.Imp’
instance GHC.Internal.Control.Monad.Fix.MonadFix Data.Complex.Complex -- Defined in ‘Data.Complex’
-instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.Data.Functor.Identity.Identity -- Defined in ‘GHC.Internal.Data.Functor.Identity’
instance [safe] forall (f :: * -> *) (g :: * -> *). (GHC.Internal.Control.Monad.Fix.MonadFix f, GHC.Internal.Control.Monad.Fix.MonadFix g) => GHC.Internal.Control.Monad.Fix.MonadFix (Data.Functor.Product.Product f g) -- Defined in ‘Data.Functor.Product’
instance GHC.Internal.Control.Monad.Fix.MonadFix Data.Semigroup.First -- Defined in ‘Data.Semigroup’
instance GHC.Internal.Control.Monad.Fix.MonadFix Data.Semigroup.Last -- Defined in ‘Data.Semigroup’
=====================================
testsuite/tests/interface-stability/template-haskell-exports.stdout
=====================================
@@ -2052,7 +2052,6 @@ instance GHC.Internal.Classes.Ord GHC.Internal.TH.Syntax.Type -- Defined in ‘G
instance GHC.Internal.Classes.Ord GHC.Internal.TH.Syntax.TypeFamilyHead -- Defined in ‘GHC.Internal.TH.Syntax’
instance GHC.Internal.Classes.Ord GHC.Internal.LanguageExtensions.Extension -- Defined in ‘GHC.Internal.LanguageExtensions’
instance GHC.Internal.Control.Monad.Fail.MonadFail GHC.Internal.TH.Monad.Q -- Defined in ‘GHC.Internal.TH.Monad’
-instance GHC.Internal.Control.Monad.Fix.MonadFix GHC.Internal.TH.Monad.Q -- Defined in ‘GHC.Internal.TH.Monad’
instance GHC.Internal.Control.Monad.IO.Class.MonadIO GHC.Internal.TH.Monad.Q -- Defined in ‘GHC.Internal.TH.Monad’
instance GHC.Internal.Data.Foldable.Foldable GHC.Internal.TH.Syntax.TyVarBndr -- Defined in ‘GHC.Internal.TH.Syntax’
instance GHC.Internal.Data.Traversable.Traversable GHC.Internal.TH.Syntax.TyVarBndr -- Defined in ‘GHC.Internal.TH.Syntax’
=====================================
testsuite/tests/mdo/should_fail/mdofail006.stderr
=====================================
@@ -5,5 +5,5 @@ cyclic evaluation in fixIO
While handling thread blocked indefinitely in an MVar operation
HasCallStack backtrace:
- throwIO, called at libraries/ghc-internal/src/GHC/Internal/System/IO.hs:641:37 in ghc-internal:GHC.Internal.System.IO
+ throwIO, called at libraries/ghc-internal/src/GHC/Internal/Control/Monad/Fix.hs:167:37 in ghc-internal:GHC.Internal.Control.Monad.Fix
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/13f4c0869e11c64937fbc3dd15a97d…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/13f4c0869e11c64937fbc3dd15a97d…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
24 Feb '26
Matthew Pickering pushed new branch wip/mp-unit-index at Glasgow Haskell Compiler / GHC
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/mp-unit-index
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/jeltsch/system-io-uncovering] 2 commits: Move some `IsString` instance declarations to `base`
by Wolfgang Jeltsch (@jeltsch) 23 Feb '26
by Wolfgang Jeltsch (@jeltsch) 23 Feb '26
23 Feb '26
Wolfgang Jeltsch pushed to branch wip/jeltsch/system-io-uncovering at Glasgow Haskell Compiler / GHC
Commits:
8241360d by Wolfgang Jeltsch at 2026-02-23T20:33:33+02:00
Move some `IsString` instance declarations to `base`
- - - - -
04369afe by Wolfgang Jeltsch at 2026-02-23T20:33:56+02:00
Move `* -> *` `Heap.Closure` instances into `ghc-heap`
- - - - -
11 changed files:
- libraries/base/src/Data/String.hs
- libraries/ghc-heap/GHC/Exts/Heap/Closures.hs
- libraries/ghc-internal/src/GHC/Internal/Data/String.hs
- libraries/ghc-internal/src/GHC/Internal/Heap/Closures.hs
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
- testsuite/tests/interface-stability/base-exports.stdout-mingw32
- testsuite/tests/interface-stability/base-exports.stdout-ws-32
- testsuite/tests/interface-stability/ghc-experimental-exports.stdout
- testsuite/tests/interface-stability/ghc-experimental-exports.stdout-mingw32
- testsuite/tests/typecheck/should_fail/T12921.stderr
Changes:
=====================================
libraries/base/src/Data/String.hs
=====================================
@@ -1,4 +1,8 @@
-{-# LANGUAGE Safe #-}
+{-# LANGUAGE Trustworthy #-}
+
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE PolyKinds #-}
+{-# LANGUAGE StandaloneDeriving #-}
-- |
--
@@ -23,4 +27,13 @@ module Data.String
unwords
) where
-import GHC.Internal.Data.String
\ No newline at end of file
+import GHC.Internal.Data.String
+
+import GHC.Internal.Data.Functor.Const (Const (Const))
+import GHC.Internal.Data.Functor.Identity (Identity (Identity))
+
+-- | @since base-4.9.0.0
+deriving instance IsString a => IsString (Const a (b :: k))
+
+-- | @since base-4.9.0.0
+deriving instance IsString a => IsString (Identity a)
=====================================
libraries/ghc-heap/GHC/Exts/Heap/Closures.hs
=====================================
@@ -1,10 +1,5 @@
{-# LANGUAGE CPP #-}
-{-# LANGUAGE ForeignFunctionInterface #-}
-{-# LANGUAGE GHCForeignImportPrim #-}
-{-# LANGUAGE MagicHash #-}
-{-# LANGUAGE RecordWildCards #-}
-{-# LANGUAGE UnliftedFFITypes #-}
-{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE DeriveTraversable #-}
-- Late cost centres introduce a thunk in the asBox function, which leads to
-- an additional wrapper being added to any value placed inside a box.
@@ -42,3 +37,23 @@ module GHC.Exts.Heap.Closures (
) where
import GHC.Internal.Heap.Closures
+
+import GHC.Internal.Data.Functor
+import GHC.Internal.Data.Foldable
+import GHC.Internal.Data.Traversable
+
+deriving instance Functor GenClosure
+deriving instance Foldable GenClosure
+deriving instance Traversable GenClosure
+
+deriving instance Functor GenStgStackClosure
+deriving instance Foldable GenStgStackClosure
+deriving instance Traversable GenStgStackClosure
+
+deriving instance Functor GenStackField
+deriving instance Foldable GenStackField
+deriving instance Traversable GenStackField
+
+deriving instance Functor GenStackFrame
+deriving instance Foldable GenStackFrame
+deriving instance Traversable GenStackFrame
=====================================
libraries/ghc-internal/src/GHC/Internal/Data/String.hs
=====================================
@@ -1,8 +1,5 @@
{-# LANGUAGE FlexibleInstances #-}
-{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE NoImplicitPrelude #-}
-{-# LANGUAGE PolyKinds #-}
-{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
@@ -33,8 +30,6 @@ module GHC.Internal.Data.String (
) where
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)
-- | `IsString` is used in combination with the @-XOverloadedStrings@
@@ -105,9 +100,3 @@ ensure the good behavior of the above example remains in the future.
instance (a ~ Char) => IsString [a] where
-- See Note [IsString String]
fromString xs = xs
-
--- | @since base-4.9.0.0
-deriving instance IsString a => IsString (Const a (b :: k))
-
--- | @since base-4.9.0.0
-deriving instance IsString a => IsString (Identity a)
=====================================
libraries/ghc-internal/src/GHC/Internal/Heap/Closures.hs
=====================================
@@ -5,7 +5,6 @@
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE UnliftedFFITypes #-}
{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE DeriveTraversable #-}
-- Late cost centres introduce a thunk in the asBox function, which leads to
-- an additional wrapper being added to any value placed inside a box.
-- This can be removed once our boot compiler is no longer affected by #25212
@@ -69,8 +68,7 @@ in the profiling way. (#15197)
import GHC.Internal.Heap.ProfInfo.Types
import GHC.Internal.Data.Bits
-import GHC.Internal.Data.Foldable (Foldable, toList)
-import GHC.Internal.Data.Traversable (Traversable)
+import GHC.Internal.Data.Foldable (toList)
import GHC.Internal.Int
import GHC.Internal.Num
import GHC.Internal.Real
@@ -383,7 +381,7 @@ data GenClosure b
-- or an Int#).
| UnknownTypeWordSizedPrimitive
{ wordVal :: !Word }
- deriving (Show, Generic, Functor, Foldable, Traversable)
+ deriving (Show, Generic)
-- | Get the info table for a heap closure, or Nothing for a prim value
--
@@ -500,7 +498,7 @@ data GenStgStackClosure b = GenStgStackClosure
, ssc_stack_size :: !Word32 -- ^ stack size in *words*
, ssc_stack :: ![GenStackFrame b]
}
- deriving (Foldable, Functor, Generic, Show, Traversable)
+ deriving (Generic, Show)
type StackField = GenStackField Box
@@ -510,7 +508,7 @@ data GenStackField b
= StackWord !Word
-- | A pointer field
| StackBox !b
- deriving (Foldable, Functor, Generic, Show, Traversable)
+ deriving (Generic, Show)
type StackFrame = GenStackFrame Box
@@ -579,7 +577,7 @@ data GenStackFrame b =
{ info_tbl :: !StgInfoTable
, annotation :: !b
}
- deriving (Foldable, Functor, Generic, Show, Traversable)
+ deriving (Generic, Show)
data PrimType
= PInt
=====================================
testsuite/tests/interface-stability/base-exports.stdout
=====================================
@@ -1673,7 +1673,7 @@ module Data.Semigroup where
stimesMonoid :: forall b a. (GHC.Internal.Real.Integral b, GHC.Internal.Base.Monoid a) => b -> a -> a
module Data.String where
- -- Safety: Safe
+ -- Safety: Trustworthy
type IsString :: * -> Constraint
class IsString a where
fromString :: String -> a
@@ -11778,8 +11778,8 @@ instance GHC.Internal.Data.Foldable.Foldable Data.Semigroup.First -- Defined in
instance GHC.Internal.Data.Foldable.Foldable Data.Semigroup.Last -- Defined in ‘Data.Semigroup’
instance GHC.Internal.Data.Foldable.Foldable Data.Semigroup.Max -- Defined in ‘Data.Semigroup’
instance GHC.Internal.Data.Foldable.Foldable Data.Semigroup.Min -- Defined in ‘Data.Semigroup’
-instance forall a k (b :: k). GHC.Internal.Data.String.IsString a => GHC.Internal.Data.String.IsString (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.String’
-instance forall a. GHC.Internal.Data.String.IsString a => GHC.Internal.Data.String.IsString (GHC.Internal.Data.Functor.Identity.Identity a) -- Defined in ‘GHC.Internal.Data.String’
+instance forall a k (b :: k). GHC.Internal.Data.String.IsString a => GHC.Internal.Data.String.IsString (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘Data.String’
+instance forall a. GHC.Internal.Data.String.IsString a => GHC.Internal.Data.String.IsString (GHC.Internal.Data.Functor.Identity.Identity a) -- Defined in ‘Data.String’
instance forall a. (a ~ GHC.Internal.Types.Char) => GHC.Internal.Data.String.IsString [a] -- Defined in ‘GHC.Internal.Data.String’
instance GHC.Internal.Data.Traversable.Traversable GHC.Internal.Functor.ZipList.ZipList -- Defined in ‘GHC.Internal.Functor.ZipList’
instance forall (f :: * -> *) (g :: * -> *). (GHC.Internal.Data.Traversable.Traversable f, GHC.Internal.Data.Traversable.Traversable g) => GHC.Internal.Data.Traversable.Traversable (f GHC.Internal.Generics.:*: g) -- Defined in ‘GHC.Internal.Data.Traversable’
=====================================
testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
=====================================
@@ -1673,7 +1673,7 @@ module Data.Semigroup where
stimesMonoid :: forall b a. (GHC.Internal.Real.Integral b, GHC.Internal.Base.Monoid a) => b -> a -> a
module Data.String where
- -- Safety: Safe
+ -- Safety: Trustworthy
type IsString :: * -> Constraint
class IsString a where
fromString :: String -> a
@@ -11805,8 +11805,8 @@ instance GHC.Internal.Data.Foldable.Foldable Data.Semigroup.First -- Defined in
instance GHC.Internal.Data.Foldable.Foldable Data.Semigroup.Last -- Defined in ‘Data.Semigroup’
instance GHC.Internal.Data.Foldable.Foldable Data.Semigroup.Max -- Defined in ‘Data.Semigroup’
instance GHC.Internal.Data.Foldable.Foldable Data.Semigroup.Min -- Defined in ‘Data.Semigroup’
-instance forall a k (b :: k). GHC.Internal.Data.String.IsString a => GHC.Internal.Data.String.IsString (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.String’
-instance forall a. GHC.Internal.Data.String.IsString a => GHC.Internal.Data.String.IsString (GHC.Internal.Data.Functor.Identity.Identity a) -- Defined in ‘GHC.Internal.Data.String’
+instance forall a k (b :: k). GHC.Internal.Data.String.IsString a => GHC.Internal.Data.String.IsString (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘Data.String’
+instance forall a. GHC.Internal.Data.String.IsString a => GHC.Internal.Data.String.IsString (GHC.Internal.Data.Functor.Identity.Identity a) -- Defined in ‘Data.String’
instance forall a. (a ~ GHC.Internal.Types.Char) => GHC.Internal.Data.String.IsString [a] -- Defined in ‘GHC.Internal.Data.String’
instance GHC.Internal.Data.Traversable.Traversable GHC.Internal.Functor.ZipList.ZipList -- Defined in ‘GHC.Internal.Functor.ZipList’
instance forall (f :: * -> *) (g :: * -> *). (GHC.Internal.Data.Traversable.Traversable f, GHC.Internal.Data.Traversable.Traversable g) => GHC.Internal.Data.Traversable.Traversable (f GHC.Internal.Generics.:*: g) -- Defined in ‘GHC.Internal.Data.Traversable’
=====================================
testsuite/tests/interface-stability/base-exports.stdout-mingw32
=====================================
@@ -1673,7 +1673,7 @@ module Data.Semigroup where
stimesMonoid :: forall b a. (GHC.Internal.Real.Integral b, GHC.Internal.Base.Monoid a) => b -> a -> a
module Data.String where
- -- Safety: Safe
+ -- Safety: Trustworthy
type IsString :: * -> Constraint
class IsString a where
fromString :: String -> a
@@ -12036,8 +12036,8 @@ instance GHC.Internal.Data.Foldable.Foldable Data.Semigroup.First -- Defined in
instance GHC.Internal.Data.Foldable.Foldable Data.Semigroup.Last -- Defined in ‘Data.Semigroup’
instance GHC.Internal.Data.Foldable.Foldable Data.Semigroup.Max -- Defined in ‘Data.Semigroup’
instance GHC.Internal.Data.Foldable.Foldable Data.Semigroup.Min -- Defined in ‘Data.Semigroup’
-instance forall a k (b :: k). GHC.Internal.Data.String.IsString a => GHC.Internal.Data.String.IsString (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.String’
-instance forall a. GHC.Internal.Data.String.IsString a => GHC.Internal.Data.String.IsString (GHC.Internal.Data.Functor.Identity.Identity a) -- Defined in ‘GHC.Internal.Data.String’
+instance forall a k (b :: k). GHC.Internal.Data.String.IsString a => GHC.Internal.Data.String.IsString (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘Data.String’
+instance forall a. GHC.Internal.Data.String.IsString a => GHC.Internal.Data.String.IsString (GHC.Internal.Data.Functor.Identity.Identity a) -- Defined in ‘Data.String’
instance forall a. (a ~ GHC.Internal.Types.Char) => GHC.Internal.Data.String.IsString [a] -- Defined in ‘GHC.Internal.Data.String’
instance GHC.Internal.Data.Traversable.Traversable GHC.Internal.Functor.ZipList.ZipList -- Defined in ‘GHC.Internal.Functor.ZipList’
instance forall (f :: * -> *) (g :: * -> *). (GHC.Internal.Data.Traversable.Traversable f, GHC.Internal.Data.Traversable.Traversable g) => GHC.Internal.Data.Traversable.Traversable (f GHC.Internal.Generics.:*: g) -- Defined in ‘GHC.Internal.Data.Traversable’
=====================================
testsuite/tests/interface-stability/base-exports.stdout-ws-32
=====================================
@@ -1673,7 +1673,7 @@ module Data.Semigroup where
stimesMonoid :: forall b a. (GHC.Internal.Real.Integral b, GHC.Internal.Base.Monoid a) => b -> a -> a
module Data.String where
- -- Safety: Safe
+ -- Safety: Trustworthy
type IsString :: * -> Constraint
class IsString a where
fromString :: String -> a
@@ -11778,8 +11778,8 @@ instance GHC.Internal.Data.Foldable.Foldable Data.Semigroup.First -- Defined in
instance GHC.Internal.Data.Foldable.Foldable Data.Semigroup.Last -- Defined in ‘Data.Semigroup’
instance GHC.Internal.Data.Foldable.Foldable Data.Semigroup.Max -- Defined in ‘Data.Semigroup’
instance GHC.Internal.Data.Foldable.Foldable Data.Semigroup.Min -- Defined in ‘Data.Semigroup’
-instance forall a k (b :: k). GHC.Internal.Data.String.IsString a => GHC.Internal.Data.String.IsString (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.String’
-instance forall a. GHC.Internal.Data.String.IsString a => GHC.Internal.Data.String.IsString (GHC.Internal.Data.Functor.Identity.Identity a) -- Defined in ‘GHC.Internal.Data.String’
+instance forall a k (b :: k). GHC.Internal.Data.String.IsString a => GHC.Internal.Data.String.IsString (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘Data.String’
+instance forall a. GHC.Internal.Data.String.IsString a => GHC.Internal.Data.String.IsString (GHC.Internal.Data.Functor.Identity.Identity a) -- Defined in ‘Data.String’
instance forall a. (a ~ GHC.Internal.Types.Char) => GHC.Internal.Data.String.IsString [a] -- Defined in ‘GHC.Internal.Data.String’
instance GHC.Internal.Data.Traversable.Traversable GHC.Internal.Functor.ZipList.ZipList -- Defined in ‘GHC.Internal.Functor.ZipList’
instance forall (f :: * -> *) (g :: * -> *). (GHC.Internal.Data.Traversable.Traversable f, GHC.Internal.Data.Traversable.Traversable g) => GHC.Internal.Data.Traversable.Traversable (f GHC.Internal.Generics.:*: g) -- Defined in ‘GHC.Internal.Data.Traversable’
=====================================
testsuite/tests/interface-stability/ghc-experimental-exports.stdout
=====================================
@@ -11188,8 +11188,6 @@ instance forall a. GHC.Internal.Classes.Ord (GHC.Internal.Ptr.FunPtr a) -- Defin
instance forall a. GHC.Internal.Classes.Ord (GHC.Internal.Ptr.Ptr a) -- Defined in ‘GHC.Internal.Ptr’
instance forall a. GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Ord (GHC.Internal.Base.NonEmpty a) -- Defined in ‘GHC.Internal.Base’
instance GHC.Internal.Classes.Ord GHC.Internal.Base.Void -- Defined in ‘GHC.Internal.Base’
-instance forall a k (b :: k). GHC.Internal.Data.String.IsString a => GHC.Internal.Data.String.IsString (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.String’
-instance forall a. GHC.Internal.Data.String.IsString a => GHC.Internal.Data.String.IsString (GHC.Internal.Data.Functor.Identity.Identity a) -- Defined in ‘GHC.Internal.Data.String’
instance forall a. (a ~ GHC.Internal.Types.Char) => GHC.Internal.Data.String.IsString [a] -- Defined in ‘GHC.Internal.Data.String’
instance forall a. GHC.Internal.Enum.Bounded a => GHC.Internal.Enum.Bounded (GHC.Internal.Data.Ord.Down a) -- Defined in ‘GHC.Internal.Data.Ord’
instance forall a. (GHC.Internal.Enum.Enum a, GHC.Internal.Enum.Bounded a, GHC.Internal.Classes.Eq a) => GHC.Internal.Enum.Enum (GHC.Internal.Data.Ord.Down a) -- Defined in ‘GHC.Internal.Data.Ord’
=====================================
testsuite/tests/interface-stability/ghc-experimental-exports.stdout-mingw32
=====================================
@@ -11191,8 +11191,6 @@ instance forall a. GHC.Internal.Classes.Ord (GHC.Internal.Ptr.FunPtr a) -- Defin
instance forall a. GHC.Internal.Classes.Ord (GHC.Internal.Ptr.Ptr a) -- Defined in ‘GHC.Internal.Ptr’
instance forall a. GHC.Internal.Classes.Ord a => GHC.Internal.Classes.Ord (GHC.Internal.Base.NonEmpty a) -- Defined in ‘GHC.Internal.Base’
instance GHC.Internal.Classes.Ord GHC.Internal.Base.Void -- Defined in ‘GHC.Internal.Base’
-instance forall a k (b :: k). GHC.Internal.Data.String.IsString a => GHC.Internal.Data.String.IsString (GHC.Internal.Data.Functor.Const.Const a b) -- Defined in ‘GHC.Internal.Data.String’
-instance forall a. GHC.Internal.Data.String.IsString a => GHC.Internal.Data.String.IsString (GHC.Internal.Data.Functor.Identity.Identity a) -- Defined in ‘GHC.Internal.Data.String’
instance forall a. (a ~ GHC.Internal.Types.Char) => GHC.Internal.Data.String.IsString [a] -- Defined in ‘GHC.Internal.Data.String’
instance forall a. GHC.Internal.Enum.Bounded a => GHC.Internal.Enum.Bounded (GHC.Internal.Data.Ord.Down a) -- Defined in ‘GHC.Internal.Data.Ord’
instance forall a. (GHC.Internal.Enum.Enum a, GHC.Internal.Enum.Bounded a, GHC.Internal.Classes.Eq a) => GHC.Internal.Enum.Enum (GHC.Internal.Data.Ord.Down a) -- Defined in ‘GHC.Internal.Data.Ord’
=====================================
testsuite/tests/typecheck/should_fail/T12921.stderr
=====================================
@@ -24,8 +24,6 @@ T12921.hs:4:16: error: [GHC-39999]
Potentially matching instance:
instance (a ~ Char) => GHC.Internal.Data.String.IsString [a]
-- Defined in ‘GHC.Internal.Data.String’
- ...plus two instances involving out-of-scope types
- (use -fprint-potential-instances to see them all)
• In the annotation:
{-# ANN module "HLint: ignore Reduce duplication" #-}
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/1d6cba74fad4f7d154768b3b360b51…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/1d6cba74fad4f7d154768b3b360b51…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
Peter Trommler pushed new branch wip/T23246 at Glasgow Haskell Compiler / GHC
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/tree/wip/T23246
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/spj-apporv-Oct24] 34 commits: Linker.MacOS reduce dynflags import
by Apoorv Ingle (@ani) 22 Feb '26
by Apoorv Ingle (@ani) 22 Feb '26
22 Feb '26
Apoorv Ingle pushed to branch wip/spj-apporv-Oct24 at Glasgow Haskell Compiler / GHC
Commits:
0e1cd2e0 by Evan Piro at 2026-02-08T10:35:16-08:00
Linker.MacOS reduce dynflags import
- - - - -
1c79a4cd by Michael Alan Dorman at 2026-02-09T08:11:51-05:00
Remove `extra_src_files` variable from `testsuite/driver/testlib.py`
While reading through the test harness code, I noticed this variable
with a TODO attached that referenced #12223. Although that bug is
closed, it strongly implied that this special-case variable that only
affected a single test was expected to be removed at some point.
I also looked at 3415bcaa0b1903b5e12dfaadb5b774718e406eab---where it
was added---whose commit message suggested that it would have been
desirable to remove it, but that there were special circumstances that
meant it had to remain (though it doesn't elucidate what those special
circumstances are).
However, the special circumstances were mentioned as if the test was
in a different location than is currently is, so I decided to try
changing the test to use the standard `extra_files` mechanism, which
works in local testing.
This also seems like a reasonable time to remove the script that was
originally used in the transition, since it doesn't really serve a
purpose anymore.
- - - - -
0020e38a by Matthew Pickering at 2026-02-09T17:29:14-05:00
determinism: Use a stable sort in WithHsDocIdentifiers binary instance
`WithHsDocIdentifiers` is defined as
```
71 data WithHsDocIdentifiers a pass = WithHsDocIdentifiers
72 { hsDocString :: !a
73 , hsDocIdentifiers :: ![Located (IdP pass)]
74 }
```
This list of names is populated from `rnHsDocIdentifiers`, which calls
`lookupGRE`, which calls `lookupOccEnv_AllNameSpaces`, which calls
`nonDetEltsUFM` and returns the results in an order depending on
uniques.
Sorting the list with a stable sort before returning the interface makes
the output deterministic and follows the approach taken by other fields
in `Docs`.
Fixes #26858
- - - - -
89898ce6 by echoumcp1 at 2026-02-09T17:30:01-05:00
Replace putstrln with logMsg in handleSeqHValueStatus
Fixes #26549
- - - - -
7c52c4f9 by John Paul Adrian Glaubitz at 2026-02-10T13:52:43-05:00
rts: Switch prim to use modern atomic compiler builtins
The __sync_*() atomic compiler builtins have been deprecated in GCC
for a while now and also don't provide variants for 64-bit values
such as __sync_fetch_and_add_8().
Thus, replace them with the modern __atomic_*() compiler builtins and
while we're at it, also drop the helper macro CAS_NAND() which is now
no longer needed since we stopped using the __sync_*() compiler builtins
altogether.
Co-authored-by: Ilias Tsitsimpis <iliastsi(a)debian.org>
Fixes #26729
- - - - -
cf60850a by Recursion Ninja at 2026-02-10T13:53:27-05:00
Decoupling L.H.S.Decls from GHC.Types.ForeignCall
- Adding TTG extension point for 'CCallTarget'
- Adding TTG extension point for 'CType'
- Adding TTG extension point for 'Header'
- Moving ForeignCall types that do not need extension
to new L.H.S.Decls.Foreign module
- Replacing 'Bool' parameters with descriptive data-types
to increase clairty and prevent "Boolean Blindness"
- - - - -
11a04cbb by Eric Lee at 2026-02-11T09:20:46-05:00
Derive Semigroup/Monoid for instances believed could be derived in #25871
- - - - -
15d9ce44 by Eric Lee at 2026-02-11T09:20:46-05:00
add Ghc.Data.Pair deriving
- - - - -
c85dc170 by Evan Piro at 2026-02-11T09:21:45-05:00
Linker.MacOS reduce options import
- - - - -
a541dd83 by Chris Wendt at 2026-02-11T16:06:41-05:00
Initialize plugins for `:set +c` in GHCi
Fixes #23110.
- - - - -
0f5a73bc by Cheng Shao at 2026-02-11T16:07:27-05:00
compiler: add Binary Text instance
This patch adds `Binary` instance for strict `Text`, in preparation of
making `Text` usable in certain GHC API use cases (e.g. haddock). This
also introduces `text` as a direct dependency of the `ghc` package.
- - - - -
9e58b8a1 by Cheng Shao at 2026-02-11T16:08:10-05:00
ghc-toolchain: add C11 check
This patch partially reverts commit
b8307eab80c5809df5405d76c822bf86877f5960 that removed C99 check in
autoconf/ghc-toolchain. Now we:
- No longer re-implement `FP_SET_CFLAGS_C11` similar to
`FP_SET_CFLAGS_C99` in the past, since autoconf doesn't provide a
convenient `AC_PROG_CC_C11` function. ghc-toolchain will handle it
anyway.
- The Cmm CPP C99 check is relanded and repurposed for C11.
- The C99 logic in ghc-toolchain is relanded and repurposed for C11.
- The C99 check in Stg.h is corrected to check for C11. The obsolete
_ISOC99_SOURCE trick is dropped.
- Usages of `-std=gnu99` in the testsuite are corrected to use
`-std=gnu11`.
Closes #26908.
- - - - -
4df0adf6 by Simon Peyton Jones at 2026-02-11T21:50:13-05:00
Simplify the treatment of static forms
This MR implements GHC proposal 732: simplify static forms,
https://github.com/ghc-proposals/ghc-proposals/pull/732
thereby addressing #26556.
See `Note [Grand plan for static forms]` in GHC.Iface.Tidy.StaticPtrTable
The main changes are:
* There is a new, simple rule for (static e), namely that the free
term variables of `e` must be bound at top level. The check is
done in the `HsStatic` case of `GHC.Rename.Expr.rnExpr`
* That in turn substantially simplifies the info that the typechecker
carries around in its type environment. Hooray.
* The desugarer emits static bindings to top level directly; see the
`HsStatic` case of `dsExpr`.
* There is no longer any special static-related magic in the FloatOut
pass. And the main Simplifier pipeline no longer needs a special case
to run FloatOut even with -O0. Hooray.
All this forced an unexpected change to the pattern match checker. It
recursively invokes the main Hs desugarer when it wants to take a look
at a term to spot some special cases (notably constructor applications).
We don't want to emit any nested (static e) bindings to top level a
second time! Yikes.
That forced a modest refactor in GHC.HsToCore.Pmc:
* The `dsl_nablas` field of `DsLclEnv` now has a `NoPmc` case, which says
"I'm desugaring just for pattern-match checking purposes".
* When that flag is set we don't emit static binds.
That in turn forces a cascade of refactoring, but the net effect is an
improvement; less risk of duplicated (even exponential?) work.
See Note [Desugaring HsExpr during pattern-match checking].
10% metric decrease, on some architectures, of compile-time max-bytes-used on T15304.
Metric Decrease:
T15304
- - - - -
7922f728 by Teo Camarasu at 2026-02-11T21:50:58-05:00
ghc-internal: avoid depending on GHC.Internal.Exts
This module is mostly just re-exports. It made sense as a user-facing
module, but there's no good reason ghc-internal modules should depend on
it and doing so linearises the module graph
- move considerAccessible to GHC.Internal.Magic
Previously it lived in GHC.Internal.Exts, but it really deserves to live
along with the other magic function, which are already re-exported from .Exts
- move maxTupleSize to GHC.Internal.Tuple
This previously lived in GHC.Internal.Exts but a comment already said it
should be moved to .Tuple
Resolves #26832
- - - - -
b6a4a29b by Eric Lee at 2026-02-11T21:51:55-05:00
Remove unused Semigroup imports to fix GHC 9.14 bootstrapping
- - - - -
99d8c146 by Simon Peyton Jones at 2026-02-12T17:36:59+00:00
Fix subtle bug in cast worker/wrapper
See (CWw4) in Note [Cast worker/wrapper].
The true payload is in the change to the definition of
GHC.Types.Id.Info.hasInlineUnfolding
Everthing else is just documentation.
There is a 2% compile time decrease for T13056;
I'll take the win!
Metric Decrease:
T13056
- - - - -
530e8e58 by Simon Peyton Jones at 2026-02-12T20:17:23-05:00
Add regression tests for four StaticPtr bugs
Tickets #26545, #24464, #24773, #16981 are all solved by the
recently-landed MR
commit 318ee13bcffa6aa8df42ba442ccd92aa0f7e210c
Author: Simon Peyton Jones <simon.peytonjones(a)gmail.com>
Date: Mon Oct 20 23:07:20 2025 +0100
Simplify the treatment of static forms
This MR just adds regression tests for them.
- - - - -
4157160f by Cheng Shao at 2026-02-13T06:27:04-05:00
ci: remove unused hlint-ghc-and-base job definition
This patch removes the unused `hlint-ghc-and-base` job definition,
it's never run since !9806. Note that hadrian lint rules still work
locally, so anyone that wishes to run hlint on the codebase can
continue to do so in their local worktree.
- - - - -
039f1977 by Cheng Shao at 2026-02-13T06:27:47-05:00
wasm: use import.meta.main for proper distinction of nodejs main modules
This patch uses `import.meta.main` for proper distinction of nodejs
main modules, especially when the main module might be installed as a
symlink. Fixes #26916.
- - - - -
14f485ee by ARATA Mizuki at 2026-02-17T09:09:24+09:00
Support more x86 extensions: AVX-512 {BW,DQ,VL} and GFNI
Also, mark AVX-512 ER and PF as deprecated.
AVX-512 instructions can be used for certain 64-bit integer vector operations.
GFNI can be used to implement bitReverse (currently not used by NCG, but LLVM may use it).
Closes #26406
Addresses #26509
- - - - -
016f79d5 by fendor at 2026-02-17T09:16:16-05:00
Hide implementation details from base exception stack traces
Ensure we hide the implementation details of the exception throwing mechanisms:
* `undefined`
* `throwSTM`
* `throw`
* `throwIO`
* `error`
The `HasCallStackBacktrace` should always have a length of exactly 1,
not showing internal implementation details in the stack trace, as these
are vastly distracting to end users.
CLC proposal [#387](https://github.com/haskell/core-libraries-committee/issues/387)
- - - - -
4f2840f2 by Brian J. Cardiff at 2026-02-17T17:04:08-05:00
configure: Accept happy-2.2
In Jan 2026 happy-2.2 was released. The most sensible change is https://github.com/haskell/happy/issues/335 which didn't trigger in a fresh build
- - - - -
10b4d364 by Duncan Coutts at 2026-02-17T17:04:52-05:00
Fix errors in the documentation of the eventlog STOP_THREAD status codes
Fix the code for BlockedOnMsgThrowTo.
Document all the known historical warts.
Fixes issue #26867
- - - - -
c5e15b8b by Phil de Joux at 2026-02-18T05:07:36-05:00
haddock: use snippets for all list examples
- generate snippet output for docs
- reduce font size to better fit snippets
- Use only directive to guard html snippets
- Add latex snippets for lists
- - - - -
d388bac1 by Phil de Joux at 2026-02-18T05:07:36-05:00
haddock: Place the snippet input and output together
- Put the output seemingly inside the example box
- - - - -
016fa306 by Samuel Thibault at 2026-02-18T05:08:35-05:00
Fix linking against libm by moving the -lm option
For those systems that need -lm for getting math functions, this is
currently added on the link line very early, before the object files being
linked together. Newer toolchains enable --as-needed by default, which means
-lm is ignored at that point because no object requires a math function
yet. With such toolchains, we thus have to add -lm after the objects, so the
linker actually includes libm in the link.
- - - - -
68bd0805 by Teo Camarasu at 2026-02-18T05:09:19-05:00
ghc-internal: Move GHC.Internal.Data.Bool to base
This is a tiny module that only defines bool :: Bool -> a -> a -> a. We can just move this to base and delete it from ghc-internal. If we want this functionality there we can just use a case statement or if-then expression.
Resolves 26865
- - - - -
4c40df3d by fendor at 2026-02-20T10:24:48-05:00
Add optional `SrcLoc` to `StackAnnotation` class
`StackAnnotation`s give access to an optional `SrcLoc` field that
user-added stack annotations can use to provide better backtraces in both error
messages and when decoding the callstack.
We update builtin stack annotations such as `StringAnnotation` and
`ShowAnnotation` to also capture the `SrcLoc` of the current `CallStack`
to improve backtraces by default (if stack annotations are used).
This change is backwards compatible with GHC 9.14.1.
- - - - -
fd9aaa28 by Simon Hengel at 2026-02-20T10:25:33-05:00
docs: Fix grammar in explicit_namespaces.rst
- - - - -
44354255 by Vo Minh Thu at 2026-02-20T18:53:06-05:00
GHCi: add a :version command.
This looks like:
ghci> :version
GHCi, version 9.11.20240322
This closes #24576.
Co-Author: Markus Läll <markus.l2ll(a)gmail.com>
- - - - -
eab3dbba by Andreas Klebinger at 2026-02-20T18:53:51-05:00
hadrian/build-cabal: Better respect and utilize -j
* We now respect -j<n> for the cabal invocation to build hadrian rather
than hardcoding -j
* We use the --semaphore flag to ensure cabal/ghc build the hadrian
executable in parallel using the -jsem mechanism.
Saves 10-15s on fresh builds for me.
Fixes #26876
- - - - -
832ddbea by Apoorv Ingle at 2026-02-22T21:56:03-06:00
Work for #25001
Notes added [Error Context Stack]
Notes updated Note [Expanding HsDo with XXExprGhcRn]
-------------------------
Metric Decrease:
T9020
-------------------------
* Streamlines implementations of `tcExpr` and `tcXExpr` to work on `XExpr`
* Kills `VACtxt` (and its associated `VAExpansion` and `VACall`) datatype, it is subsumed by simply a `SrcSpan`.
* Kills the function `addHeadCtxt` as it is now mearly setting a location
* The function `tcValArgs` does its own argument number management
* Makes `splitHsApps` not look through `XExpr`
* `tcExprSigma` is called if the head of the expression after calling `splitHsApps` turns out to be an `XExpr`
* Removes location information from `OrigPat` payload
* Removes special case of tcBody from `tcLambdaMatches`
* Removes special case of `dsExpr` for `ExpandedThingTc`
* Rename `HsThingRn` to `SrcCodeCtxt`
* Kills `tcl_in_gen_code` and `tcl_err_ctxt`. It is subsumed by `ErrCtxtStack`
* Kills `ExpectedFunTyOrig`. It is subsumed by `CtOrigin`
* Fixes `CtOrigin` for `HsProjection` case in `exprCtOrigin`. It was previously assigned to be `SectionOrigin`. It is now just the expression
* Adds a new `CtOrigin.ExpansionOrigin` for storing the original syntax
* Adds a new `CtOrigin.ExpectedTySyntax` as a replacement for `ExpectedTySyntaxOp`. Cannot kill the former yet because of `ApplicativeDo`
* Renames `tcMonoExpr` -> `tcMonoLExpr`, `tcMonoExprNC` -> `tcMonoLExpr`
* Renames `EValArg`, `EValArgQL` fields: `ea_ctxt` -> `ea_loc_span` and `eaql_ctx` -> `eaql_loc_span`
* kill `PopErrCtxt` from `XXExprGhcRn`
* simplify `addArgCtxt` and push `setSrcSpan` inside `addLExprCtxt`. Make sure addExprCtxt is not called by itself
* fun_orig in tcApp depends on the SrcSpan of the head of the application chain (similar to addArgCtxt)
* rename fun_ctxt to fun_lspan, fun_orig passed in tcInstFun to default to app chain head if its user located, fall back to srcCodeOrigin if it's a generated location
* fix quickLookArg function to blame the correct application chain head. The arguments application chain head should be blamed, not the original head when we quick look arg
* Make sure only expression wrapped around generated src span are ignored while adding them to the error context stack
* `getDeepSubsumptionFlag_DataConHead` performs a non-trivial traversal if the expression passed to it is complex.
This traversal is necessary if the head of the function is an `XExpr` and `splitHsApps` does not look through them
- The deepsubsumption flag is stored in EVAlArgQL to reduce the need to call `getDeepSubsumptionFlag_DataConHead`
- `getDeepSubsumptionFlag_DataConHead` is called in `tcExprSigma` and `tcInferAppHead` to reduce AST traversals
* Make a new variant `GeneratedSrcSpan` in `SrcSpan` for HIEAst Nodes
* wrap `fromListN` with a generated src span with GeneratedSrcSpanDetails field to store the original srcspan
* remove `UnhelpfulGenerated` from `UnhelpfulSpanReason` and into new datatype `GeneratedSrcSpanDetails`
- - - - -
775bb8d3 by Simon Peyton Jones at 2026-02-22T21:56:27-06:00
Wibbles
- - - - -
bacf1d88 by Apoorv Ingle at 2026-02-22T21:56:28-06:00
notes update
Note [Typechecking by expansion: overview]
- - - - -
345 changed files:
- .gitlab-ci.yml
- compiler/GHC.hs
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/CmmToAsm/Config.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/CmmToAsm/X86/Instr.hs
- compiler/GHC/CmmToAsm/X86/Ppr.hs
- compiler/GHC/CmmToLlvm/CodeGen.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Opt/Pipeline.hs
- compiler/GHC/Core/Opt/SetLevels.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/WorkWrap.hs
- compiler/GHC/Core/TyCon.hs
- compiler/GHC/CoreToStg.hs
- compiler/GHC/CoreToStg/AddImplicitBinds.hs
- compiler/GHC/Data/Pair.hs
- compiler/GHC/Driver/Config/CmmToAsm.hs
- compiler/GHC/Driver/Config/Core/Lint.hs
- compiler/GHC/Driver/DynFlags.hs
- compiler/GHC/Driver/Pipeline/Execute.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Hs/Binds.hs
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/Doc.hs
- compiler/GHC/Hs/DocString.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Instances.hs
- compiler/GHC/Hs/Syn/Type.hs
- compiler/GHC/Hs/Type.hs
- compiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore.hs
- compiler/GHC/HsToCore/Docs.hs
- compiler/GHC/HsToCore/Errors/Types.hs
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/Foreign/C.hs
- compiler/GHC/HsToCore/Foreign/Call.hs
- compiler/GHC/HsToCore/Foreign/Decl.hs
- compiler/GHC/HsToCore/Foreign/JavaScript.hs
- compiler/GHC/HsToCore/Foreign/Utils.hs
- compiler/GHC/HsToCore/Foreign/Wasm.hs
- compiler/GHC/HsToCore/GuardedRHSs.hs
- compiler/GHC/HsToCore/Match.hs
- compiler/GHC/HsToCore/Monad.hs
- compiler/GHC/HsToCore/Pmc.hs
- compiler/GHC/HsToCore/Pmc/Desugar.hs
- compiler/GHC/HsToCore/Pmc/Solver.hs
- compiler/GHC/HsToCore/Pmc/Solver/Types.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/HsToCore/Ticks.hs
- compiler/GHC/HsToCore/Types.hs
- compiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Iface/Ext/Utils.hs
- compiler/GHC/Iface/Syntax.hs
- compiler/GHC/Iface/Tidy.hs
- compiler/GHC/Iface/Tidy/StaticPtrTable.hs
- compiler/GHC/Linker/Dynamic.hs
- compiler/GHC/Linker/MacOS.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/HaddockLex.x
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Parser/PostProcess/Haddock.hs
- compiler/GHC/Rename/Bind.hs
- compiler/GHC/Rename/Expr.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/Rename/Names.hs
- compiler/GHC/Rename/Utils.hs
- compiler/GHC/Runtime/Debugger/Breakpoints.hs
- compiler/GHC/Runtime/Heap/Inspect.hs
- compiler/GHC/Runtime/Interpreter.hs
- compiler/GHC/StgToByteCode.hs
- compiler/GHC/StgToCmm/Foreign.hs
- compiler/GHC/StgToJS/FFI.hs
- compiler/GHC/SysTools/Cpp.hs
- compiler/GHC/Tc/Deriv.hs
- compiler/GHC/Tc/Errors.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Gen/App.hs
- + compiler/GHC/Tc/Gen/App.hs-boot
- compiler/GHC/Tc/Gen/Bind.hs
- compiler/GHC/Tc/Gen/Do.hs
- compiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Gen/Expr.hs-boot
- compiler/GHC/Tc/Gen/Foreign.hs
- compiler/GHC/Tc/Gen/Head.hs
- compiler/GHC/Tc/Gen/Match.hs
- compiler/GHC/Tc/Gen/Pat.hs
- compiler/GHC/Tc/Gen/Sig.hs
- compiler/GHC/Tc/Gen/Splice.hs
- compiler/GHC/Tc/Instance/Class.hs
- compiler/GHC/Tc/Module.hs
- compiler/GHC/Tc/Solver.hs
- compiler/GHC/Tc/Solver/Monad.hs
- compiler/GHC/Tc/TyCl.hs
- compiler/GHC/Tc/TyCl/Instance.hs
- compiler/GHC/Tc/TyCl/Utils.hs
- compiler/GHC/Tc/Types.hs
- compiler/GHC/Tc/Types/BasicTypes.hs
- compiler/GHC/Tc/Types/Constraint.hs
- compiler/GHC/Tc/Types/CtLoc.hs
- compiler/GHC/Tc/Types/ErrCtxt.hs
- compiler/GHC/Tc/Types/LclEnv.hs
- compiler/GHC/Tc/Types/Origin.hs
- compiler/GHC/Tc/Utils/Env.hs
- compiler/GHC/Tc/Utils/Monad.hs
- compiler/GHC/Tc/Utils/TcMType.hs
- − compiler/GHC/Tc/Utils/TcMType.hs-boot
- compiler/GHC/Tc/Utils/Unify.hs
- compiler/GHC/Tc/Zonk/TcType.hs
- compiler/GHC/Tc/Zonk/Type.hs
- compiler/GHC/ThToHs.hs
- compiler/GHC/Types/Error.hs
- compiler/GHC/Types/ForeignCall.hs
- compiler/GHC/Types/Hint/Ppr.hs
- compiler/GHC/Types/Id/Info.hs
- compiler/GHC/Types/Id/Make.hs
- compiler/GHC/Types/Name/Reader.hs
- compiler/GHC/Types/SrcLoc.hs
- compiler/GHC/Types/Unique/DSet.hs
- compiler/GHC/Utils/Binary.hs
- compiler/GHC/Utils/Logger.hs
- compiler/GHC/Utils/Ppr/Colour.hs
- compiler/Language/Haskell/Syntax/Decls.hs
- + compiler/Language/Haskell/Syntax/Decls/Foreign.hs
- compiler/Language/Haskell/Syntax/Extension.hs
- compiler/ghc.cabal.in
- configure.ac
- distrib/configure.ac.in
- + docs/users_guide/10.0.1-notes.rst
- docs/users_guide/9.16.1-notes.rst
- docs/users_guide/eventlog-formats.rst
- docs/users_guide/exts/explicit_namespaces.rst
- docs/users_guide/ghci.rst
- docs/users_guide/phases.rst
- docs/users_guide/using.rst
- ghc/GHCi/UI.hs
- ghc/GHCi/UI/Info.hs
- hadrian/build-cabal
- libraries/base/changelog.md
- libraries/base/src/Data/Bool.hs
- libraries/base/src/Data/List.hs
- libraries/base/src/Data/List/NubOrdSet.hs
- libraries/base/src/GHC/Exts.hs
- libraries/ghc-experimental/CHANGELOG.md
- libraries/ghc-experimental/src/GHC/Stack/Annotation/Experimental.hs
- + libraries/ghc-experimental/tests/Makefile
- + libraries/ghc-experimental/tests/all.T
- + libraries/ghc-experimental/tests/backtraces/Makefile
- + libraries/ghc-experimental/tests/backtraces/T26806a.hs
- + libraries/ghc-experimental/tests/backtraces/T26806a.stderr
- + libraries/ghc-experimental/tests/backtraces/T26806b.hs
- + libraries/ghc-experimental/tests/backtraces/T26806b.stderr
- + libraries/ghc-experimental/tests/backtraces/T26806c.hs
- + libraries/ghc-experimental/tests/backtraces/T26806c.stderr
- + libraries/ghc-experimental/tests/backtraces/all.T
- libraries/ghc-internal/ghc-internal.cabal.in
- − libraries/ghc-internal/src/GHC/Internal/Data/Bool.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Foldable.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Function.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Type/Bool.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Type/Ord.hs
- libraries/ghc-internal/src/GHC/Internal/Data/Version.hs
- libraries/ghc-internal/src/GHC/Internal/Exception.hs
- libraries/ghc-internal/src/GHC/Internal/Exts.hs
- libraries/ghc-internal/src/GHC/Internal/Heap/Closures.hs
- libraries/ghc-internal/src/GHC/Internal/IO/FD.hs
- libraries/ghc-internal/src/GHC/Internal/JS/Foreign/Callback.hs
- libraries/ghc-internal/src/GHC/Internal/JS/Prim.hs
- libraries/ghc-internal/src/GHC/Internal/JS/Prim/Internal/Build.hs
- libraries/ghc-internal/src/GHC/Internal/Magic.hs
- libraries/ghc-internal/src/GHC/Internal/STM.hs
- libraries/ghc-internal/src/GHC/Internal/Stack/Annotation.hs
- libraries/ghc-internal/src/GHC/Internal/Stack/Decode.hs
- libraries/ghc-internal/src/GHC/Internal/System/IO/OS.hs
- libraries/ghc-internal/src/GHC/Internal/TH/Lift.hs
- libraries/ghc-internal/src/GHC/Internal/Tuple.hs
- libraries/ghc-internal/src/GHC/Internal/TypeError.hs
- libraries/ghc-internal/src/GHC/Internal/Wasm/Prim/Exports.hs
- libraries/ghc-internal/src/GHC/Internal/Wasm/Prim/Imports.hs
- libraries/ghc-internal/src/GHC/Internal/Wasm/Prim/Types.hs
- + libraries/ghc-internal/tests/backtraces/T15395.hs
- + libraries/ghc-internal/tests/backtraces/T15395.stdout
- libraries/ghc-internal/tests/backtraces/all.T
- libraries/ghc-internal/tests/stack-annotation/ann_frame001.stdout
- libraries/ghc-internal/tests/stack-annotation/ann_frame002.stdout
- libraries/ghc-internal/tests/stack-annotation/ann_frame003.stdout
- libraries/ghc-internal/tests/stack-annotation/ann_frame004.stdout
- libraries/ghc-internal/tests/stack-annotation/ann_frame005.stdout
- m4/fp_cmm_cpp_cmd_with_args.m4
- m4/fptools_happy.m4
- rts/include/Stg.h
- rts/prim/atomic.c
- testsuite/driver/cpu_features.py
- − testsuite/driver/kill_extra_files.py
- testsuite/driver/testlib.py
- testsuite/tests/arrows/should_compile/T21301.stderr
- testsuite/tests/codeGen/should_gen_asm/all.T
- + testsuite/tests/codeGen/should_gen_asm/avx512-int64-minmax.asm
- + testsuite/tests/codeGen/should_gen_asm/avx512-int64-minmax.hs
- + testsuite/tests/codeGen/should_gen_asm/avx512-int64-mul.asm
- + testsuite/tests/codeGen/should_gen_asm/avx512-int64-mul.hs
- + testsuite/tests/codeGen/should_gen_asm/avx512-word64-minmax.asm
- + testsuite/tests/codeGen/should_gen_asm/avx512-word64-minmax.hs
- testsuite/tests/codeGen/should_run/CgStaticPointers.hs
- testsuite/tests/codeGen/should_run/CgStaticPointersNoFullLazyness.hs
- testsuite/tests/count-deps/CountDepsAst.stdout
- testsuite/tests/count-deps/CountDepsParser.stdout
- testsuite/tests/deSugar/should_fail/DsStrictFail.stderr
- testsuite/tests/deSugar/should_run/T20024.stderr
- testsuite/tests/deSugar/should_run/dsrun005.stderr
- testsuite/tests/deSugar/should_run/dsrun007.stderr
- testsuite/tests/deSugar/should_run/dsrun008.stderr
- testsuite/tests/deriving/should_run/T9576.stderr
- testsuite/tests/ffi/should_run/all.T
- testsuite/tests/ghci/scripts/Defer02.stderr
- testsuite/tests/ghci/scripts/T15325.stderr
- testsuite/tests/ghci/scripts/T20150.stdout
- testsuite/tests/indexed-types/should_fail/T2693.stderr
- testsuite/tests/indexed-types/should_fail/T5439.stderr
- 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/overloadedrecflds/should_fail/T26480b.stderr
- testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
- testsuite/tests/parser/should_compile/T14189.stderr
- testsuite/tests/parser/should_fail/RecordDotSyntaxFail10.stderr
- testsuite/tests/parser/should_fail/RecordDotSyntaxFail11.stderr
- testsuite/tests/parser/should_fail/RecordDotSyntaxFail8.stderr
- testsuite/tests/patsyn/should_run/ghci.stderr
- + testsuite/tests/plugins/T23110.hs
- + testsuite/tests/plugins/T23110.script
- + testsuite/tests/plugins/T23110.stdout
- testsuite/tests/plugins/all.T
- testsuite/tests/plugins/test-defaulting-plugin.stderr
- testsuite/tests/printer/T17697.stderr
- testsuite/tests/process/all.T
- testsuite/tests/quotes/LiftErrMsgDefer.stderr
- testsuite/tests/rebindable/rebindable6.stderr
- testsuite/tests/rename/should_fail/RnStaticPointersFail01.stderr
- testsuite/tests/rename/should_fail/RnStaticPointersFail03.stderr
- + testsuite/tests/rename/should_fail/T26545.hs
- + testsuite/tests/rename/should_fail/T26545.stderr
- testsuite/tests/rename/should_fail/all.T
- testsuite/tests/rep-poly/RepPolyDoBind.stderr
- testsuite/tests/rep-poly/RepPolyDoBody1.stderr
- testsuite/tests/rep-poly/RepPolyDoBody2.stderr
- testsuite/tests/rep-poly/RepPolyRecordUpdate.stderr
- testsuite/tests/safeHaskell/safeLanguage/SafeLang15.stderr
- testsuite/tests/showIface/DocsInHiFile1.stdout
- testsuite/tests/showIface/HaddockSpanIssueT24378.stdout
- testsuite/tests/showIface/MagicHashInHaddocks.stdout
- testsuite/tests/simd/should_run/all.T
- + testsuite/tests/simplCore/should_compile/T26903.hs
- + testsuite/tests/simplCore/should_compile/T26903.stderr
- testsuite/tests/simplCore/should_compile/T8331.stderr
- testsuite/tests/simplCore/should_compile/all.T
- testsuite/tests/type-data/should_run/T22332a.stderr
- + testsuite/tests/typecheck/should_compile/ExpansionQLIm.hs
- testsuite/tests/typecheck/should_compile/T14590.stderr
- + testsuite/tests/typecheck/should_compile/T24464.hs
- testsuite/tests/typecheck/should_compile/all.T
- testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr
- testsuite/tests/typecheck/should_fail/DoExpansion1.stderr
- testsuite/tests/typecheck/should_fail/DoExpansion2.stderr
- testsuite/tests/typecheck/should_fail/T10971d.stderr
- testsuite/tests/typecheck/should_fail/T13311.stderr
- testsuite/tests/typecheck/should_fail/T3323.stderr
- testsuite/tests/typecheck/should_fail/T3613.stderr
- testsuite/tests/typecheck/should_fail/T6069.stderr
- testsuite/tests/typecheck/should_fail/T7851.stderr
- testsuite/tests/typecheck/should_fail/T7857.stderr
- testsuite/tests/typecheck/should_fail/T8603.stderr
- testsuite/tests/typecheck/should_fail/T9612.stderr
- testsuite/tests/typecheck/should_fail/tcfail102.stderr
- testsuite/tests/typecheck/should_fail/tcfail128.stderr
- testsuite/tests/typecheck/should_fail/tcfail140.stderr
- testsuite/tests/typecheck/should_fail/tcfail181.stderr
- testsuite/tests/typecheck/should_run/T10284.stderr
- testsuite/tests/typecheck/should_run/T13838.stderr
- + testsuite/tests/typecheck/should_run/T16981.hs
- + testsuite/tests/typecheck/should_run/T16981.stdout
- + testsuite/tests/typecheck/should_run/T24773.hs
- + testsuite/tests/typecheck/should_run/T24773.stdout
- testsuite/tests/typecheck/should_run/T9497a-run.stderr
- testsuite/tests/typecheck/should_run/T9497b-run.stderr
- testsuite/tests/typecheck/should_run/T9497c-run.stderr
- testsuite/tests/typecheck/should_run/all.T
- testsuite/tests/unsatisfiable/T23816.stderr
- testsuite/tests/unsatisfiable/UnsatDefer.stderr
- testsuite/tests/warnings/should_fail/CaretDiagnostics1.stderr
- utils/check-exact/ExactPrint.hs
- utils/check-exact/Parsers.hs
- utils/check-exact/Transform.hs
- utils/check-exact/Utils.hs
- utils/ghc-toolchain/src/GHC/Toolchain/Tools/Cc.hs
- utils/ghc-toolchain/src/GHC/Toolchain/Tools/Cpp.hs
- utils/haddock/doc/.gitignore
- utils/haddock/doc/Makefile
- + utils/haddock/doc/_static/haddock-custom.css
- utils/haddock/doc/conf.py
- utils/haddock/doc/markup.rst
- + utils/haddock/doc/snippets/.gitignore
- + utils/haddock/doc/snippets/Lists.hs
- + utils/haddock/doc/snippets/Makefile
- + utils/haddock/doc/snippets/Snippet-List-Bulleted.html
- + utils/haddock/doc/snippets/Snippet-List-Bulleted.tex
- + utils/haddock/doc/snippets/Snippet-List-Definition.html
- + utils/haddock/doc/snippets/Snippet-List-Definition.tex
- + utils/haddock/doc/snippets/Snippet-List-Enumerated.html
- + utils/haddock/doc/snippets/Snippet-List-Enumerated.tex
- + utils/haddock/doc/snippets/Snippet-List-Indentation.html
- + utils/haddock/doc/snippets/Snippet-List-Indentation.tex
- + utils/haddock/doc/snippets/Snippet-List-Multiline-Item.html
- + utils/haddock/doc/snippets/Snippet-List-Multiline-Item.tex
- + utils/haddock/doc/snippets/Snippet-List-Nested-Item.html
- + utils/haddock/doc/snippets/Snippet-List-Nested-Item.tex
- + utils/haddock/doc/snippets/Snippet-List-Not-Newline.html
- + utils/haddock/doc/snippets/Snippet-List-Not-Newline.tex
- + utils/haddock/doc/snippets/Snippet-List-Not-Separated.html
- + utils/haddock/doc/snippets/Snippet-List-Not-Separated.tex
- utils/haddock/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Utils.hs
- utils/haddock/haddock-api/src/Haddock/Interface/LexParseRn.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs
- utils/haddock/haddock-api/src/Haddock/Types.hs
- utils/haddock/html-test/ref/A.html
- utils/haddock/html-test/ref/Bug1004.html
- utils/haddock/html-test/ref/Bug1033.html
- utils/haddock/html-test/ref/Bug1103.html
- utils/haddock/html-test/ref/Bug548.html
- utils/haddock/html-test/ref/Bug923.html
- utils/haddock/html-test/ref/ConstructorPatternExport.html
- utils/haddock/html-test/ref/FunArgs.html
- utils/haddock/html-test/ref/Hash.html
- utils/haddock/html-test/ref/Instances.html
- utils/haddock/html-test/ref/LinearTypes.html
- utils/haddock/html-test/ref/RedactTypeSynonyms.html
- utils/haddock/html-test/ref/T23616.html
- utils/haddock/html-test/ref/Test.html
- utils/haddock/html-test/ref/TypeFamilies3.html
- utils/jsffi/dyld.mjs
- utils/jsffi/post-link.mjs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/bf6586bdd937eea5107f283f69ca0c…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/bf6586bdd937eea5107f283f69ca0c…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/ani/kill-SrcCodeOrigin] some in complete data defs
by Apoorv Ingle (@ani) 22 Feb '26
by Apoorv Ingle (@ani) 22 Feb '26
22 Feb '26
Apoorv Ingle pushed to branch wip/ani/kill-SrcCodeOrigin at Glasgow Haskell Compiler / GHC
Commits:
4800bc7c by Apoorv Ingle at 2026-02-22T21:39:54-06:00
some in complete data defs
- - - - -
6 changed files:
- compiler/GHC/Hs/Instances.hs
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Gen/Match.hs
- compiler/GHC/Tc/TyCl/Instance.hs
Changes:
=====================================
compiler/GHC/Hs/Instances.hs
=====================================
@@ -620,48 +620,18 @@ deriving instance Eq (IE GhcTc)
-- ---------------------------------------------------------------------
--- deriving instance Data ErrCtxtMsg
--- deriving instance Data XXExprGhcRn
-con_ExpandedThingRn = mkConstr xXExprGhcRn_T "ExpandedThingRn" [] Prefix
-con_HsRecSelRn = mkConstr xXExprGhcRn_T "HsRecSelRn" [] Prefix
-xXExprGhcRn_T = mkDataType "GHC.Hs.Expr.XXExprGhcRn" []
+instance Data ErrCtxtMsg where
+ gunfold _ _ _ = error "no gunfold for ErrCtxtMsg"
+ gfoldl _ _ _ = error "no goldl for ErrCtxtMsg"
-instance Data XXExprGhcRn where
- toConstr (ExpandedThingRn{}) = con_ExpandedThingRn
- toConstr (HsRecSelRn{}) = con_HsRecSelRn
- dataTypeOf _ = xXExprGhcRn_T
-
- gunfold k z c = error "no gunfold for XXExprGhcRn"
- gfoldl k z c = error "no gfoldl for XXExprGhcRn"
+deriving instance Data XXExprGhcRn
deriving instance Data a => Data (WithUserRdr a)
--- ---------------------------------------------------------------------
-
--- deriving instance Data XXExprGhcTc
-con_ExpandedThingTc = mkConstr xXExprGhcTc_T "ExpandedThingTc" [] Prefix
-con_WrapExpr = mkConstr xXExprGhcTc_T "WrapExpr" [] Prefix
-con_ConLikeTc = mkConstr xXExprGhcTc_T "ConLikeTc" [] Prefix
-con_HsTick = mkConstr xXExprGhcTc_T "HsTick" [] Prefix
-con_HsBinTick = mkConstr xXExprGhcTc_T "HsBinTick" [] Prefix
-con_HsRecSelTc = mkConstr xXExprGhcTc_T "HsRecSelTc" [] Prefix
-xXExprGhcTc_T = mkDataType "GHC.Hs.Expr.XXExprGhcTc" []
-
-instance Data XXExprGhcTc where
- toConstr (ExpandedThingTc{}) = con_ExpandedThingTc
- toConstr (WrapExpr{}) = con_WrapExpr
- toConstr (ConLikeTc{}) = con_ConLikeTc
- toConstr (HsTick{}) = con_HsTick
- toConstr (HsBinTick{}) = con_HsBinTick
- toConstr (HsRecSelTc{}) = con_HsRecSelTc
-
- dataTypeOf _ = xXExprGhcTc_T
-
-
- gunfold _ _ _ = error "no gunfold for XXExprGhcTc"
- gfoldl _ _ _ = error "no gfoldl for XXExprGhcTc"
-
+-- -------------------------------
+--------------------------------------
+deriving instance Data XXExprGhcTc
deriving instance Data XXPatGhcTc
-- ---------------------------------------------------------------------
=====================================
compiler/GHC/HsToCore/Expr.hs
=====================================
@@ -40,6 +40,7 @@ import GHC.Hs
-- needs to see source types
import GHC.Tc.Utils.TcType
import GHC.Tc.Types.Evidence
+import GHC.Tc.Types.ErrCtxt
import GHC.Tc.Utils.Monad
import GHC.Tc.Instance.Class (lookupHasFieldLabel)
@@ -296,7 +297,7 @@ dsExpr e@(XExpr ext_expr_tc)
ConLikeTc {} -> dsApp e
ExpandedThingTc o e
- | OrigStmt (L loc _) _ <- o -- c.f. T14546d. We have lost the location of the first statement in the GhcRn -> GhcTc
+ | DoStmtErrCtxt _ (L loc _) <- o -- c.f. T14546d. We have lost the location of the first statement in the GhcRn -> GhcTc
-> putSrcSpanDsA loc $ dsExpr e
| otherwise -> dsExpr e
=====================================
compiler/GHC/HsToCore/Quote.hs
=====================================
@@ -41,6 +41,7 @@ import GHC.Hs.Decls.Overlap ( OverlapMode(..) )
import GHC.Tc.Utils.TcType
import GHC.Tc.Types.Evidence
+import GHC.Tc.Types.ErrCtxt
import GHC.Tc.TyCl ( IsPrefixConGADT(..), unannotatedMultIsLinear )
import GHC.Core.Class
@@ -1732,7 +1733,7 @@ repE (HsFunArr _ mult arg res) = do
res' <- repLE res
repApps fun [arg', res']
repE e@(XExpr (ExpandedThingRn o x))
- | OrigExpr e <- o
+ | ExprCtxt e <- o
= do { rebindable_on <- lift $ xoptM LangExt.RebindableSyntax
; if rebindable_on -- See Note [Quotation and rebindable syntax]
then repE x
=====================================
compiler/GHC/Tc/Gen/Expr.hs
=====================================
@@ -268,6 +268,13 @@ tcCheckMonoExpr, tcCheckMonoExprNC
tcCheckMonoExpr expr res_ty = tcMonoLExpr expr (mkCheckExpType res_ty)
tcCheckMonoExprNC expr res_ty = tcMonoLExprNC expr (mkCheckExpType res_ty)
+
+-- Expand the HsExpr if it is typechecked after expansions
+-- See Note [Handling overloaded and rebindable constructs]
+-- See Note [Typechecking by expansion: overview]
+expand_expr :: HsExpr GhcRn -> TcM (HsExpr GhcRn)
+expand_expr x = return x
+
---------------
tcMonoLExpr, tcMonoLExprNC
:: LHsExpr GhcRn -- Expression to type check
@@ -276,9 +283,10 @@ tcMonoLExpr, tcMonoLExprNC
-> TcM (LHsExpr GhcTc)
tcMonoLExpr (L loc expr) res_ty
- = addLExprCtxt (locA loc) expr $ -- Note [Error contexts in generated code]
- do { expr' <- tcExpr expr res_ty
- ; return (L loc expr') }
+ = do expanded_expr <- expand_expr expr
+ addLExprCtxt (locA loc) expanded_expr $ -- Note [Error contexts in generated code]
+ do { expr' <- tcExpr expr res_ty
+ ; return (L loc expr') }
tcMonoLExprNC (L loc expr) res_ty
= setSrcSpanA loc $
@@ -676,7 +684,7 @@ tcExpr expr@(RecordUpd { rupd_expr = record_expr
; (ds_expr, ds_res_ty, err_msg)
<- expandRecordUpd record_expr possible_parents rbnds res_ty
- ; addExpansionErrCtxt (ExprCtxt expr) err_msg $
+ ; addExpansionErrCtxt err_msg $
do { -- Typecheck the expanded expression.
expr' <- tcExpr ds_expr (Check ds_res_ty)
-- NB: it's important to use ds_res_ty and not res_ty here.
=====================================
compiler/GHC/Tc/Gen/Match.hs
=====================================
@@ -487,7 +487,7 @@ tcStmtsAndThen ctxt stmt_chk (L loc stmt : stmts) res_ty thing_inside
| otherwise
= do { (stmt', (stmts', thing)) <-
setSrcSpanA loc $
- addErrCtxt (StmtErrCtxt ctxt (L loc stmt)) $
+ addErrCtxt (StmtErrCtxt ctxt stmt) $
stmt_chk ctxt stmt res_ty $ \ res_ty' ->
popErrCtxt $
tcStmtsAndThen ctxt stmt_chk stmts res_ty' $
=====================================
compiler/GHC/Tc/TyCl/Instance.hs
=====================================
@@ -2108,7 +2108,7 @@ tcMethodBodyHelp hs_sig_fn sel_id local_meth_id meth_bind
-- The instance-sig is the focus here; the class-meth-sig
-- is fixed (#18036)
; let orig = InstanceSigOrigin sel_name sig_ty local_meth_ty
- ; hs_wrap <- addErrCtxtM (MethSigCtxt sel_name sig_ty meth_ty) $
+ ; hs_wrap <- addErrCtxtM (MethSigCtxt sel_name sig_ty local_meth_ty) $
tcSubTypeSigma orig ctxt sig_ty local_meth_ty
; return (sig_ty, hs_wrap) }
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4800bc7c37b8085d840c3e41cbd1f2e…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4800bc7c37b8085d840c3e41cbd1f2e…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
Simon Peyton Jones pushed to branch wip/T26868 at Glasgow Haskell Compiler / GHC
Commits:
70cc6607 by Simon Peyton Jones at 2026-02-22T18:24:43+00:00
Add missing file!
- - - - -
1 changed file:
- + compiler/GHC/Types/Var/FV.hs
Changes:
=====================================
compiler/GHC/Types/Var/FV.hs
=====================================
@@ -0,0 +1,230 @@
+{-# LANGUAGE PatternSynonyms #-}
+
+-- | Utilities for efficiently and deterministically computing free variables.
+module GHC.Types.Var.FV (
+ FV( runFV, MkFV ),
+ BoundVars, VarSetFV, DVarSetFV, SelectiveFV,
+ TyCoFV, DTyCoFV,
+ runFVTop, runFVAcc, runTyCoVars, runTyCoVarsDSet,
+ runFVSelective, runFVSelectiveList, runFVSelectiveSet,
+ InterestingVarFun,
+
+ addBndrFV, addBndrsFV, addBndrSelectiveFV, addBndrsSelectiveFV,
+ emptyFV, -- or `mempty`
+ unionFV, -- or `mappend`
+ mapUnionFV
+ ) where
+
+import GHC.Prelude
+
+import GHC.Types.Var
+import GHC.Types.Var.Set
+
+import GHC.Utils.EndoOS
+
+import GHC.Exts( oneShot )
+import Data.Semigroup
+
+{- Note [Finding free variables]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+We have lots of different free-variable finders:
+ * Shallow or deep: do we include the kind of a variable occurrence
+ * Deterministic or non-determinstic: what kind of set is collected
+ * Selective or not: selective means there is a predicate that says
+ which variables are of interest
+
+The type (FV env set) is the result-type of a free-variable finder, e.g.
+ tyCoVarsOfType :: Type -> FV BoundVars VarSet
+
+Here
+ * `env` is an environment, which records the locally-bound varaibles
+ (which are not of interest since they aren't free) and optionally
+ the selective predicate.
+
+ * `set` is the accumulating result set
+
+The FV type is roughly
+
+ type FV env set = env -> set -> set
+
+So `tyCoVarsOfType ty` is a function that takes an environment a set-
+valued accumulator, and extends the set with the free vars of `ty`.
+See (FV1) for why we use an accumulating parameter here.
+
+However, we want to take the union of two FV values, thus
+ tyCoVarsOfType t1 `mappend` tyCoVarsOfType t2
+We do this by making `FV` an instance of `Monoid` and `Semigroup`
+and using `mappend`. So we use a newtype wrapper.
+
+Some important wrinkles for efficiency:
+
+(FV1) Accumulating parameter for the free variables. We could return a
+ VarSet, and do lots of `unionVarSet`. But it's quite a bit more efficient
+ to use an accumulating parameter and add free variables one at a time.
+
+ We implement this using a (GHC-specific variant of) the standard `Endo`
+ type. The `mappend` for `Endo` is just function composition; see
+ GHC.Utils.Endo
+
+ This is more efficient for two reasons:
+ * Doing a tree of `unionVarSet` calls is asymptotically inefficient.
+ * For "deep" free variables, if we have an accumulator we can see if we
+ have encountered this variable before; if so, we don't need to look at its
+ kind. See Note [Shallow and deep free variables] in GHC.Core.TyCo.FVs
+
+(FV2) Eta expansion. It's very important that, after optimisation, we end up
+ with an arity-3 function. Let's consider:
+
+ tyCoVarsOfType (AppTy a b) = tyCoVarsOfType a `mappend` tyCoVarsOfType b
+
+ If we aren't careful, ater inlining `mappend`, we'll end up with
+
+ tyCoVarsOfType = \ty ->
+ case ty of
+ AppTy a b -> \env acc ->
+ tyCoVarsOfType a env (tyCoVarsOfType env acc)
+
+ which has to create a lambda, entirely unnecessarily. On the other hand if it
+ is eta-expanded, we get this:
+
+ tyCoVarsOfType = \ty env acc->
+ case ty of
+ AppTy a b -> tyCoVarsOfType a env (tyCoVarsOfType env acc)
+
+ We achieve this using the "one-shot trick" described in
+ Note [The one-shot state monad trick] in GHC.Utils.Monad, both for the
+ `env` parameter (see `oneShot` call in this module), and the `acc`
+ accumulator (see `onShot` call in GHC.Utils.EndoOS).
+
+ See also #11146.
+
+(FV3) Avoiding thunks. The `mappend` for `Endo` is just function composition,
+ but we don't want to get code like
+ tyCoVarsOfType (AppTy a b) env acc = tyCoVarsOfType a env $ tyCoVarsOfType b env acc
+ because that argument is a thunk. We want to be strict in the accumulator, so we get
+ tyCoVarsOfType (AppTy a b) env acc = tyCoVarsOfType env a $! tyCoVarsOfType b env acc
+ The strictness is done by the (<>) mmthod in `EndoOS`.
+
+(FV4) Order. When computing order-deterministic free vars, we'd like to return the
+ variables in left-to-right order. Thus, the free vars of (a -> b -> b) should
+ be [a,b] not [b,a]. This matters for quantifying variables in a predictable
+ way.
+
+ We achieve this by
+ * Combining sub-expressions in the natural left-to-right way. e.g.
+ tyCoVarsOfType (AppTy a b) = tyCoVarsOfType a `unionFV` tyCoVarsOfType b
+ * Ihe EndoOS instance, make (f <> g) do (g.f), that is compose "backwards"
+
+Note [Deterministic FV]
+~~~~~~~~~~~~~~~~~~~~~~~
+When computing free variables, the order in which you get them affects
+the results of floating and specialization. If you use UniqFM to collect
+them and then turn that into a list, you get them in nondeterministic
+order as described in Note [Deterministic UniqFM] in GHC.Types.Unique.DFM.
+
+So we instead collect them in a `DVarSet` (deterministic VarSet).
+-}
+
+
+{- *********************************************************************
+* *
+ Free-var result type
+* *
+********************************************************************* -}
+
+type InterestingVarFun = Var -> Bool
+
+type BoundVars = TyCoVarSet
+
+type VarSetFV = FV BoundVars (EndoOS TyCoVarSet)
+type DVarSetFV = FV BoundVars (EndoOS DTyCoVarSet)
+type SelectiveFV = FV (InterestingVarFun, BoundVars) (EndoOS DVarSet)
+-- VarSetFV: collects a VarSet
+-- DVarSetFV: collects a DVarSet (deterministic)
+-- SelectiveFV: selectively collects a DVarSet
+-- Why EndoOS? See (FV1) in Note [Finding free variables]
+
+type TyCoFV = VarSetFV
+type DTyCoFV = DVarSetFV
+
+newtype FV env acc = MkFV' { runFV :: env -> acc }
+ -- Caries an environment (typically empty, or a set of in-scope variables)
+ -- and a composable accumulator.
+ --
+ -- NB: `acc` is usually (EndoOS something) but not always;
+ -- see for example GHC.Core.TyCo.FVs.afvFolder
+
+pattern MkFV :: (env -> acc) -> FV env acc
+{-# COMPLETE MkFV #-}
+pattern MkFV f <- MkFV' f
+ where
+ MkFV f = MkFV' (oneShot f)
+ -- oneShot: this is the core of the one-shot trick!
+ -- Note [The one-shot state monad trick] in GHC.Utils.Monad.
+
+instance Semigroup a => Semigroup (FV env a) where
+ (<>) = unionFV
+
+instance Monoid a => Monoid (FV env a) where
+ mempty = emptyFV
+
+emptyFV :: Monoid a => FV env a
+emptyFV = MkFV (\_ -> mempty)
+
+unionFV :: Semigroup a => FV env a -> FV env a -> FV env a
+unionFV (MkFV' f1) (MkFV' f2) = MkFV (\env -> f1 env <> f2 env)
+
+upd_bndrs_fv :: (env -> env) -> FV env a -> FV env a
+{-# INLINE addBndrFV #-}
+upd_bndrs_fv upd f = MkFV (\bvs -> runFV f $! upd bvs)
+ -- Strict application to avoid making a thunk
+
+addBndrFV :: TyCoVar -> FV BoundVars a -> FV BoundVars a
+addBndrFV tcv = upd_bndrs_fv (\bvs -> extendVarSet bvs tcv)
+
+addBndrsFV :: [Var] -> FV BoundVars a -> FV BoundVars a
+addBndrsFV tcvs = upd_bndrs_fv (\bvs -> extendVarSetList bvs tcvs)
+
+addBndrSelectiveFV :: TyCoVar -> FV (f, BoundVars) a -> FV (f, BoundVars) a
+addBndrSelectiveFV tcv
+ = upd_bndrs_fv (\(f,bvs) -> let !bvs' = extendVarSet bvs tcv
+ -- Strict let to avoid thunks
+ in (f,bvs'))
+
+addBndrsSelectiveFV :: [Var] -> FV (f, BoundVars) a -> FV (f, BoundVars) a
+addBndrsSelectiveFV bs
+ = upd_bndrs_fv (\(f,bvs) -> let !bvs' = extendVarSetList bvs bs
+ -- Strict let to avoid thunks
+ in (f,bvs'))
+
+mapUnionFV :: (Foldable t, Monoid acc)
+ => (a -> FV env acc) -> t a -> FV env acc
+{-# INLINE mapUnionFV #-}
+mapUnionFV f xs = foldr (mappend . f) mempty xs
+
+
+runFVTop :: FV BoundVars a -> a
+{-# INLINE runFVTop #-}
+runFVTop f = runFV f (emptyVarSet :: BoundVars)
+
+runFVAcc :: FV BoundVars (EndoOS a) -> a -> a
+{-# INLINE runFVAcc #-}
+runFVAcc f = runEndoOS (runFVTop f)
+
+runTyCoVars :: TyCoFV -> TyCoVarSet
+{-# INLINE runTyCoVars #-}
+runTyCoVars f = runFVAcc f emptyVarSet
+
+runTyCoVarsDSet :: DTyCoFV -> DTyCoVarSet
+{-# INLINE runTyCoVarsDSet #-}
+runTyCoVarsDSet f = runFVAcc f emptyDVarSet
+
+runFVSelective :: InterestingVarFun -> SelectiveFV -> DVarSet
+runFVSelective interesting f
+ = runEndoOS (runFV f (interesting, emptyVarSet)) emptyDVarSet
+
+runFVSelectiveList :: InterestingVarFun -> SelectiveFV -> [Var]
+runFVSelectiveList interesting f = dVarSetElems (runFVSelective interesting f)
+
+runFVSelectiveSet :: InterestingVarFun -> SelectiveFV -> VarSet
+runFVSelectiveSet interesting f = dVarSetToVarSet (runFVSelective interesting f)
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/70cc6607e91c2a8a512269ce864e6e0…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/70cc6607e91c2a8a512269ce864e6e0…
You're receiving this email because of your account on gitlab.haskell.org.
1
0
[Git][ghc/ghc][wip/T26868] Major refactor of free-variable functions
by Simon Peyton Jones (@simonpj) 22 Feb '26
by Simon Peyton Jones (@simonpj) 22 Feb '26
22 Feb '26
Simon Peyton Jones pushed to branch wip/T26868 at Glasgow Haskell Compiler / GHC
Commits:
d3f56f61 by Simon Peyton Jones at 2026-02-21T22:55:58+00:00
Major refactor of free-variable functions
For some time we have had two free-variable mechanims for types:
* The "FV" mechanism, embodied in GHC.Utils.FV, which worked OK, but
was fragile where eta-expansion was concerned.
* The TyCoFolder mechanism, using a one-shot EndoOS accumulator
I finally got tired of this and refactored the whole thing. Now we have
* GHC.Types.Var.FV, which has a composable free-variable result type,
very much in the spirit of the old `FV`, but much more robust.
(It uses the "one shot trick".)
* GHC.Core.TyCo.FVs now has just one technology for free variables.
All this led to a lot of renaming.
- - - - -
18 changed files:
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/FVs.hs
- compiler/GHC/Core/Opt/SetLevels.hs
- compiler/GHC/Core/Opt/Specialise.hs
- compiler/GHC/Core/Subst.hs
- compiler/GHC/Core/TyCo/FVs.hs
- compiler/GHC/Core/Type.hs
- compiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Tc/Gen/App.hs
- compiler/GHC/Tc/Types/Constraint.hs
- compiler/GHC/Tc/Types/Evidence.hs
- compiler/GHC/Tc/Utils/TcMType.hs
- compiler/GHC/Tc/Utils/TcType.hs
- compiler/GHC/Tc/Utils/Unify.hs
- compiler/GHC/Utils/EndoOS.hs
- − compiler/GHC/Utils/FV.hs
- compiler/ghc.cabal.in
- utils/haddock/haddock-api/src/Haddock/GhcUtils.hs
Changes:
=====================================
compiler/GHC/Core/Coercion.hs
=====================================
@@ -78,7 +78,6 @@ module GHC.Core.Coercion (
-- ** Free variables
tyCoVarsOfCo, tyCoVarsOfCos, coVarsOfCo,
- tyCoFVsOfCo, tyCoVarsOfCoDSet,
coercionSize, anyFreeVarsOfCo,
-- ** Substitution
=====================================
compiler/GHC/Core/FVs.hs
=====================================
@@ -35,7 +35,7 @@ module GHC.Core.FVs (
ruleLhsFreeIds, ruleLhsFreeIdsList,
ruleRhsFreeVars, rulesRhsFreeIds,
- exprFVs, addBndrFV, addBndrsFV, unitFV,
+ exprFVs, addCoreBndrFV, addCoreBndrsFV, unitFV,
-- * Orphan names
orphNamesOfType, orphNamesOfTypes, orphNamesOfAxiomLHS,
@@ -61,8 +61,9 @@ import GHC.Types.Id.Info
import GHC.Types.Name.Set
import GHC.Types.Name
import GHC.Types.Tickish
-import GHC.Types.Var.Set
import GHC.Types.Var
+import GHC.Types.Var.Set
+import GHC.Types.Var.FV
import GHC.Core.Type
import GHC.Core.TyCo.Rep
import GHC.Core.TyCo.FVs
@@ -154,10 +155,10 @@ exprsFreeIdsList = dVarSetElems . exprsFreeIdsDSet
bindFreeVars :: CoreBind -> VarSet
bindFreeVars = runFVSelectiveSet isLocalVar . bind_fvs
-bind_fvs :: CoreBind -> SelectiveFVRes
+bind_fvs :: CoreBind -> SelectiveFV
bind_fvs (NonRec b r) = rhs_fvs (b,r)
-bind_fvs (Rec prs) = addBndrsSelectiveFVRes (map fst prs) $
- mapUnionFVRes rhs_fvs prs
+bind_fvs (Rec prs) = addBndrsSelectiveFV (map fst prs) $
+ mapUnionFV rhs_fvs prs
-- | Finds free variables in an expression selected by a predicate
exprSomeFreeVars :: InterestingVarFun -- ^ Says which 'Var's are interesting
@@ -199,20 +200,20 @@ exprsSomeFreeVarsDSet :: InterestingVarFun -- ^ Says which 'Var's are interestin
-> DVarSet
exprsSomeFreeVarsDSet fv_cand = runFVSelective fv_cand . exprsFVs
-addBndrFV :: CoreBndr -> SelectiveFVRes -> SelectiveFVRes
-addBndrFV bndr fvr
+addCoreBndrFV :: CoreBndr -> SelectiveFV -> SelectiveFV
+addCoreBndrFV bndr fvr
= bndrTypeTyCoFVs bndr `mappend`
-- Include type variables in the binder's type
-- (not just Ids; coercion variables too!)
- addBndrSelectiveFVRes bndr fvr
+ addBndrSelectiveFV bndr fvr
-addBndrsFV :: [CoreBndr] -> SelectiveFVRes -> SelectiveFVRes
-addBndrsFV bndrs fv = foldr addBndrFV fv bndrs
+addCoreBndrsFV :: [CoreBndr] -> SelectiveFV -> SelectiveFV
+addCoreBndrsFV bndrs fv = foldr addCoreBndrFV fv bndrs
-unitFV :: Var -> SelectiveFVRes
+unitFV :: Var -> SelectiveFV
-- Deals with an occurrence
-- Shallow: does not look at the kind
-unitFV v = FVRes (\bvs -> EndoOS (do_it bvs))
+unitFV v = MkFV (\bvs -> EndoOS (do_it bvs))
where
do_it (is_interesting,bvs) acc
| not (is_interesting v) = acc -- The "selective" bit
@@ -220,49 +221,49 @@ unitFV v = FVRes (\bvs -> EndoOS (do_it bvs))
| v `elemDVarSet` acc = acc
| otherwise = acc `extendDVarSet` v
-exprsFVs :: [CoreExpr] -> SelectiveFVRes
-exprsFVs = mapUnionFVRes exprFVs
+exprsFVs :: [CoreExpr] -> SelectiveFV
+exprsFVs = mapUnionFV exprFVs
-exprFVs :: CoreExpr -> SelectiveFVRes
-exprFVs (Type ty) = tyCoFVsOfType ty
-exprFVs (Coercion co) = tyCoFVsOfCo co
+exprFVs :: CoreExpr -> SelectiveFV
+exprFVs (Type ty) = shallowSelTypeFV ty
+exprFVs (Coercion co) = shallowSelCoFV co
exprFVs (Var var) = unitFV var
exprFVs (Lit _) = mempty
exprFVs (Tick t expr) = tickish_fvs t `mappend` exprFVs expr
exprFVs (App fun arg) = exprFVs fun `mappend` exprFVs arg
-exprFVs (Lam bndr body) = addBndrFV bndr (exprFVs body)
-exprFVs (Cast expr co) = exprFVs expr `mappend` tyCoFVsOfCo co
+exprFVs (Lam bndr body) = addCoreBndrFV bndr (exprFVs body)
+exprFVs (Cast expr co) = exprFVs expr `mappend` shallowSelCoFV co
exprFVs (Case scrut bndr ty alts)
- = exprFVs scrut `mappend` tyCoFVsOfType ty `mappend`
- addBndrFV bndr (mapUnionFVRes alt_fvs alts)
+ = exprFVs scrut `mappend` shallowSelTypeFV ty `mappend`
+ addCoreBndrFV bndr (mapUnionFV alt_fvs alts)
where
- alt_fvs (Alt _ bndrs rhs) = addBndrsFV bndrs (exprFVs rhs)
+ alt_fvs (Alt _ bndrs rhs) = addCoreBndrsFV bndrs (exprFVs rhs)
exprFVs (Let (NonRec bndr rhs) body)
- = rhs_fvs (bndr, rhs) `mappend` addBndrFV bndr (exprFVs body)
+ = rhs_fvs (bndr, rhs) `mappend` addCoreBndrFV bndr (exprFVs body)
exprFVs (Let (Rec pairs) body)
- = addBndrsFV (map fst pairs) $
- mapUnionFVRes rhs_fvs pairs `mappend` exprFVs body
+ = addCoreBndrsFV (map fst pairs) $
+ mapUnionFV rhs_fvs pairs `mappend` exprFVs body
---------
-rhs_fvs :: (Id, CoreExpr) -> SelectiveFVRes
+rhs_fvs :: (Id, CoreExpr) -> SelectiveFV
rhs_fvs (bndr, rhs) = exprFVs rhs `mappend`
bndrRuleAndUnfoldingFVs bndr
-- Treat any RULES as extra RHSs of the binding
---------
-tickish_fvs :: CoreTickish -> SelectiveFVRes
-tickish_fvs (Breakpoint _ _ ids) = mapUnionFVRes unitFV ids
+tickish_fvs :: CoreTickish -> SelectiveFV
+tickish_fvs (Breakpoint _ _ ids) = mapUnionFV unitFV ids
tickish_fvs _ = mempty
---------
-bndrTypeTyCoFVs :: Var -> SelectiveFVRes
+bndrTypeTyCoFVs :: Var -> SelectiveFV
-- Find the free variables of a binder.
-- In the case of ids, don't forget the multiplicity field!
bndrTypeTyCoFVs var
- = tyCoFVsOfType (varType var) `mappend` mult_fvs
+ = shallowSelTypeFV (varType var) `mappend` mult_fvs
where
mult_fvs = case varMultMaybe var of
- Just mult -> tyCoFVsOfType mult
+ Just mult -> shallowSelTypeFV mult
Nothing -> mempty
dBndrTypeTyCoVars :: Var -> DTyCoVarSet
@@ -278,7 +279,7 @@ dBndrFreeVars :: Id -> DVarSet
-- Shallow free vars
dBndrFreeVars id = runFVSelective isLocalVar $ bndrFVs id
-bndrFVs :: Id -> SelectiveFVRes
+bndrFVs :: Id -> SelectiveFV
-- Shallow free vars of types, rules, and inlining
bndrFVs id = assert (isId id) $
bndrTypeTyCoFVs id `mappend`
@@ -290,7 +291,7 @@ bndrRuleAndUnfoldingVarsDSet = runFVSelective isLocalVar . bndrRuleAndUnfoldingF
bndrRuleAndUnfoldingVars :: Id -> VarSet
bndrRuleAndUnfoldingVars = dVarSetToVarSet . bndrRuleAndUnfoldingVarsDSet
-bndrRuleAndUnfoldingFVs :: Id -> SelectiveFVRes
+bndrRuleAndUnfoldingFVs :: Id -> SelectiveFV
bndrRuleAndUnfoldingFVs id
| isId id = idRuleFVs id `mappend` idUnfoldingFVs id
| otherwise = mempty
@@ -298,7 +299,7 @@ bndrRuleAndUnfoldingFVs id
idRuleVars :: Id -> VarSet -- Does *not* include CoreUnfolding vars
idRuleVars = dVarSetToVarSet . ruleInfoFreeVars . idSpecialisation
-idRuleFVs :: Id -> SelectiveFVRes
+idRuleFVs :: Id -> SelectiveFV
idRuleFVs id = assert (isId id) $
strictFoldDVarSet (mappend . unitFV) mempty $
ruleInfoFreeVars (idSpecialisation id)
@@ -311,21 +312,21 @@ idUnfoldingVars :: Id -> VarSet
-- we might get out-of-scope variables
idUnfoldingVars = runFVSelectiveSet isLocalVar . idUnfoldingFVs
-idUnfoldingFVs :: Id -> SelectiveFVRes
+idUnfoldingFVs :: Id -> SelectiveFV
idUnfoldingFVs id = stableUnfoldingFVs (realIdUnfolding id) `orElse` mempty
stableUnfoldingVars :: Unfolding -> Maybe VarSet
stableUnfoldingVars unf = fmap (runFVSelectiveSet isLocalVar) $
stableUnfoldingFVs unf
-stableUnfoldingFVs :: Unfolding -> Maybe SelectiveFVRes
+stableUnfoldingFVs :: Unfolding -> Maybe SelectiveFV
stableUnfoldingFVs unf
= case unf of
CoreUnfolding { uf_tmpl = rhs, uf_src = src }
| isStableSource src
-> Just (exprFVs rhs)
DFunUnfolding { df_bndrs = bndrs, df_args = args }
- -> Just (addBndrsFV bndrs (exprsFVs args))
+ -> Just (addCoreBndrsFV bndrs (exprsFVs args))
-- DFuns are top level, so no fvs from types of bndrs
_other -> Nothing
@@ -497,13 +498,13 @@ data RuleFVsFrom
-- | Those locally-defined variables free in the left and/or right hand sides
-- of the rule, depending on the first argument.
-ruleFVs :: RuleFVsFrom -> CoreRule -> SelectiveFVRes
+ruleFVs :: RuleFVsFrom -> CoreRule -> SelectiveFV
ruleFVs !_ (BuiltinRule {}) = mempty
ruleFVs from (Rule { ru_fn = _do_not_include
-- See Note [Rule free var hack]
, ru_bndrs = bndrs
, ru_rhs = rhs, ru_args = args })
- = addBndrsFV bndrs (exprsFVs exprs)
+ = addCoreBndrsFV bndrs (exprsFVs exprs)
where
exprs = case from of
LhsOnly -> args
@@ -512,8 +513,8 @@ ruleFVs from (Rule { ru_fn = _do_not_include
-- | Those locally-defined variables free in the left and/or right hand sides
-- from several rules, depending on the first argument.
-rulesFVs :: RuleFVsFrom -> [CoreRule] -> SelectiveFVRes
-rulesFVs from = mapUnionFVRes (ruleFVs from)
+rulesFVs :: RuleFVsFrom -> [CoreRule] -> SelectiveFV
+rulesFVs from = mapUnionFV (ruleFVs from)
-- | Those variables free in the right hand side of a rule returned as a
-- non-deterministic set
@@ -666,7 +667,7 @@ freeVarsBind (Rec binds) body_fvs
(binders, rhss) = unzip binds
rhss2 = map freeVars rhss
rhs_body_fvs = foldr (unionDVarSet . freeVarsOf) body_fvs rhss2
- binders_fvs = runFVSelective isLocalVar $ mapUnionFVRes bndrRuleAndUnfoldingFVs binders
+ binders_fvs = runFVSelective isLocalVar $ mapUnionFV bndrRuleAndUnfoldingFVs binders
-- See Note [The FVAnn invariant]
all_fvs = rhs_body_fvs `unionDVarSet` binders_fvs
-- The "delBinderFV" happens after adding the idSpecVars,
=====================================
compiler/GHC/Core/Opt/SetLevels.hs
=====================================
@@ -101,6 +101,7 @@ import GHC.Types.Id
import GHC.Types.Id.Info
import GHC.Types.Var
import GHC.Types.Var.Set
+import GHC.Types.Var.FV
import GHC.Types.Unique.Set ( nonDetStrictFoldUniqSet )
import GHC.Types.Unique.DSet ( getUniqDSet )
import GHC.Types.Var.Env
@@ -1380,7 +1381,7 @@ lvlBind env (AnnRec pairs)
bind_fvs = ((unionDVarSets [ freeVarsOf rhs | (_, rhs) <- pairs])
`unionDVarSet`
(runFVSelective isLocalVar $
- mapUnionFVRes (\(bndr,_) -> bndrFVs bndr) pairs))
+ mapUnionFV (\(bndr,_) -> bndrFVs bndr) pairs))
`delDVarSetList`
bndrs
=====================================
compiler/GHC/Core/Opt/Specialise.hs
=====================================
@@ -54,6 +54,7 @@ import GHC.Types.Id.Make ( voidArgId, voidPrimId )
import GHC.Types.Var
import GHC.Types.Var.Set
import GHC.Types.Var.Env
+import GHC.Types.Var.FV
import GHC.Types.Id
import GHC.Types.Id.Info
import GHC.Types.InlinePragma
@@ -2512,10 +2513,10 @@ specArgsFVs :: InterestingVarFun -> [SpecArg] -> VarSet
-- Find the shallow deep free vars of the SpecArgs that are not already in scope
specArgsFVs interesting args
= runFVSelectiveSet interesting $
- mapUnionFVRes get args
+ mapUnionFV get args
where
- get :: SpecArg -> SelectiveFVRes
- get (SpecType ty) = tyCoFVsOfType ty
+ get :: SpecArg -> SelectiveFV
+ get (SpecType ty) = shallowSelTypeFV ty
get (SpecDict dx) = exprFVs dx
get UnspecType = mempty
get UnspecArg = mempty
=====================================
compiler/GHC/Core/Subst.hs
=====================================
@@ -48,6 +48,7 @@ import GHC.Core.Coercion( mkCoVarCo, substCoVarBndr )
import GHC.Core.TyCo.FVs
import GHC.Types.Var.Set
+import GHC.Types.Var.FV
import GHC.Types.Var.Env as InScopeSet
import GHC.Types.Id
import GHC.Types.Name ( Name )
@@ -594,10 +595,10 @@ substDVarSet subst@(Subst _ _ tv_env cv_env) fvs
= runFVSelective isLocalVar $
strictFoldDVarSet (mappend . do_one) mempty fvs
where
- do_one :: Var -> SelectiveFVRes
+ do_one :: Var -> SelectiveFV
do_one fv
- | isTyVar fv = tyCoFVsOfType (lookupVarEnv tv_env fv `orElse` mkTyVarTy fv)
- | isCoVar fv = tyCoFVsOfCo (lookupVarEnv cv_env fv `orElse` mkCoVarCo fv)
+ | isTyVar fv = shallowSelTypeFV (lookupVarEnv tv_env fv `orElse` mkTyVarTy fv)
+ | isCoVar fv = shallowSelCoFV (lookupVarEnv cv_env fv `orElse` mkCoVarCo fv)
| otherwise = exprFVs (lookupIdSubst subst fv)
------------------
=====================================
compiler/GHC/Core/TyCo/FVs.hs
=====================================
@@ -1,17 +1,7 @@
-{-# LANGUAGE MultiWayIf, PatternSynonyms #-}
+{-# LANGUAGE MultiWayIf #-}
module GHC.Core.TyCo.FVs
- ( -- FVRes and friends
- FVRes( runFV, FVRes ),
- addBndrFVRes, addBndrsFVRes, addBndrSelectiveFVRes, addBndrsSelectiveFVRes,
- mapUnionFVRes, shallowUnitFVRes, deepUnitFVRes,
- BoundVars, VarSetFVRes, DVarSetFVRes, SelectiveFVRes,
- TyCoFVRes, DTyCoFVRes,
- runFVTop, runFVAcc, runTyCoVars, runTyCoVarsDSet,
- runFVSelective, runFVSelectiveList, runFVSelectiveSet,
- InterestingVarFun,
-
- -- Shallow
+ ( -- Shallow
shallowTyCoVarsOfType, shallowTyCoVarsOfTypes,
shallowTyCoVarsOfCo, shallowTyCoVarsOfCos,
shallowTyCoVarsOfTyVarEnv, shallowTyCoVarsOfCoVarEnv,
@@ -20,13 +10,13 @@ module GHC.Core.TyCo.FVs
tyCoVarsOfType, tyCoVarsOfTypes, tyCoVarsOfTypesList,
tyCoVarsOfThings,
tyCoVarsOfCo, tyCoVarsOfCos, tyCoVarsOfMCo,
- deepTcvFolder, deepTypeFV, deepCoFV,
+ deepTcvFolder, deepTypeFV, deepTypesFV, deepCoFV,
-- Deep, deterministic
tyCoVarsOfTypeDSet, tyCoVarsOfTypesDSet, tyCoVarsOfTypeList,
tyCoVarsOfCoDSet, tyCoVarsOfCoList,
tyCoVarsOfThingsDSet,
- detTyCoVarsOfType, detTyCoVarsOfTypes, detTyCoVarsOfCo,
+ deepDetTypeFV, deepDetTypesFV, deepDetCoFV,
-- Selective
someTyCoVarsOfType, someTyCoVarsOfTypes,
@@ -37,7 +27,7 @@ module GHC.Core.TyCo.FVs
coVarsOfCoDSet, coVarsOfCosDSet,
-- Shallow, deterministic, composable
- tyCoFVsOfType, tyCoFVsOfCo,
+ shallowSelTypeFV, shallowSelCoFV,
-- Almost devoid
almostDevoidCoVarOfCo,
@@ -76,6 +66,7 @@ import GHC.Core.TyCon
import GHC.Core.Coercion.Axiom( CoAxiomRule(..), BuiltInFamRewrite(..), coAxiomTyCon )
import GHC.Types.Var
+import GHC.Types.Var.FV
import GHC.Types.Unique.FM
import GHC.Types.Unique.Set
@@ -86,7 +77,6 @@ import GHC.Utils.Misc
import GHC.Utils.EndoOS
import GHC.Data.Pair
-import GHC.Exts (oneShot)
import Data.Semigroup
@@ -120,97 +110,42 @@ Examples:
(a : (k:Type)) {a} {a,k}
forall (a:(k:Type)). a {k} {k}
(a:k->Type) (b:k) {a,b} {a,b,k}
--}
-
-
-{- Note [Free variables of types]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The family of functions tyCoVarsOfType, tyCoVarsOfTypes etc, returns
-a VarSet that is closed over the types of its variables. More precisely,
- if S = tyCoVarsOfType( t )
- and (a:k) is in S
- then tyCoVarsOftype( k ) is a subset of S
-
-Example: The tyCoVars of this ((a:* -> k) Int) is {a, k}.
-
-We could /not/ close over the kinds of the variable occurrences, and
-instead do so at call sites, but it seems that we always want to do
-so, so it's easiest to do it here.
-
-It turns out that getting the free variables of types is performance critical,
-so we profiled several versions, exploring different implementation strategies.
-
-1. Baseline version: uses FV naively. Essentially:
-
- tyCoVarsOfType ty = fvVarSet $ tyCoFVsOfType ty
-
- This is not nice, because FV introduces some overhead to implement
- determinism, and through its "interesting var" function, neither of which
- we need here, so they are a complete waste.
-2. UnionVarSet version: instead of reusing the FV-based code, we simply used
- VarSets directly, trying to avoid the overhead of FV. E.g.:
- -- FV version:
- tyCoFVsOfType (AppTy fun arg) a b c = (tyCoFVsOfType fun `unionFV` tyCoFVsOfType arg) a b c
+Note [Computing deep free variables]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+tyCoVarsOfType computes the /deep/ free variables of a type; that is, if
+`a::k` is in the result, then so are the free vars of `k`. We say that the
+resulting set is "closed over kinds".
- -- UnionVarSet version:
- tyCoVarsOfType (AppTy fun arg) = (tyCoVarsOfType fun `unionVarSet` tyCoVarsOfType arg)
+But we must take care (see #14880):
- This looks deceptively similar, but while FV internally builds a list- and
- set-generating function, the VarSet functions manipulate sets directly, and
- the latter performs a lot worse than the naive FV version.
+1. Efficiency. If we have Proxy (a::ki) -> Proxy (a::ki) -> Proxy (a::ki), then
+ we don't want to have to traverse ki more than once.
-3. Accumulator-style VarSet version: this is what we use now. We do use VarSet
- as our data structure, but delegate the actual work to a new
- ty_co_vars_of_... family of functions, which use accumulator style and the
- "in-scope set" filter found in the internals of FV, but without the
- determinism overhead.
-
-See #14880.
-
-Note [Closing over free variable kinds]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-tyCoVarsOfType and tyCoFVsOfType, while traversing a type, will also close over
-free variable kinds. In previous GHC versions, this happened naively: whenever
-we would encounter an occurrence of a free type variable, we would close over
-its kind. This, however is wrong for two reasons (see #14880):
-
-1. Efficiency. If we have Proxy (a::k) -> Proxy (a::k) -> Proxy (a::k), then
- we don't want to have to traverse k more than once.
-
-2. Correctness. Imagine we have forall k. b -> k, where b has
- kind k, for some k bound in an outer scope. If we look at b's kind inside
+2. Correctness. Imagine we have forall k. (b::k) -> k, where b has
+ kind k, for some k bound in an /outer/ scope. If we look at b's kind inside
the forall, we'll collect that k is free and then remove k from the set of
free variables. This is plain wrong. We must instead compute that b is free
and then conclude that b's kind is free.
-An obvious first approach is to move the closing-over-kinds from the
-occurrences of a type variable to after finding the free vars - however, this
-turns out to introduce performance regressions, and isn't even entirely
-correct.
-
-In fact, it isn't even important *when* we close over kinds; what matters is
-that we handle each type var exactly once, and that we do it in the right
-context.
+An obvious first approach is to compute the /shallow/ free variables of the type,
+and /then/ close over kinds. But that turns out not to be very efficient.
+Fortunately, there is a simpler way, which works with the accumulating
+free-var story described in (FV1) of Note [Finding free variables] in
+GHC.Types.Var.FV. At an occurrence of a variable (a::k)
-So the next approach we tried was to use the "in-scope set" part of FV or the
-equivalent argument in the accumulator-style `ty_co_vars_of_type` function, to
-say "don't bother with variables we have already closed over". This should work
-fine in theory, but the code is complicated and doesn't perform well.
+* Check if `a` is a locally-bound var; if so, ignore it.
-But there is a simpler way, which is implemented here. Consider the two points
-above:
+* Check if `a` is already in the accumulator; if so, ignore it because we have
+ deal with its kind already. Also pre-checking set membership before inserting
+ ends up not only being faster,
-1. Efficiency: we now have an accumulator, so the second time we encounter 'a',
- we'll ignore it, certainly not looking at its kind - this is why
- pre-checking set membership before inserting ends up not only being faster,
- but also being correct.
+* Otherwise add `a` to the accumulator,
+ AND add on the free vars of its kind `k`.
+ BUT in this latter step, start with an empty BoundVars set.
-2. Correctness: we have an "in-scope set" (I think we should call it it a
- "bound-var set"), specifying variables that are bound by a forall in the type
- we are traversing; we simply ignore these variables, certainly not looking at
- their kind.
+This twist is implemented in `deepUnitFV`
So now consider:
@@ -222,22 +157,6 @@ this is our first encounter with b; we want the free vars of its kind. But we
want to behave as if we took the free vars of its kind at the end; that is,
with no bound vars in scope.
-So the solution is easy. The old code was this:
-
- ty_co_vars_of_type (TyVarTy v) is acc
- | v `elemVarSet` is = acc
- | v `elemVarSet` acc = acc
- | otherwise = ty_co_vars_of_type (tyVarKind v) is (extendVarSet acc v)
-
-Now all we need to do is take the free vars of tyVarKind v *with an empty
-bound-var set*, thus:
-
-ty_co_vars_of_type (TyVarTy v) is acc
- | v `elemVarSet` is = acc
- | v `elemVarSet` acc = acc
- | otherwise = ty_co_vars_of_type (tyVarKind v) emptyVarSet (extendVarSet acc v)
- ^^^^^^^^^^^
-
And that's it. This works because a variable is either bound or free. If it is bound,
then we won't look at it at all. If it is free, then all the variables free in its
kind are free -- regardless of whether some local variable has the same Unique.
@@ -266,147 +185,6 @@ The sole reason is in Note [Emitting the residual implication in simplifyInfer]
in GHC.Tc.Solver. Yuk. This is not pretty.
-}
-{- *********************************************************************
-* *
- Endo for free variables
-* *
-********************************************************************* -}
-
-{- Note [Accumulating parameter free variables]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-We can use foldType to build an accumulating-parameter version of a
-free-var finder, thus:
-
- fvs :: Type -> TyCoVarSet
- fvs ty = appEndo (foldType folder ty) emptyVarSet
-
-Recall that
- foldType :: TyCoFolder env a -> env -> Type -> a
-
- newtype Endo a = Endo (a -> a) -- In Data.Monoid
- instance Monoid a => Monoid (Endo a) where
- (Endo f) `mappend` (Endo g) = Endo (f.g)
-
- appEndo :: Endo a -> a -> a
- appEndo (Endo f) x = f x
-
-So `mappend` for Endos is just function composition.
-
-It's very important that, after optimisation, we end up with
-* an arity-three function
-* that is strict in the accumulator
-
- fvs env (TyVarTy v) acc
- | v `elemVarSet` env = acc
- | v `elemVarSet` acc = acc
- | otherwise = acc `extendVarSet` v
- fvs env (AppTy t1 t2) = fvs env t1 (fvs env t2 acc)
- ...
-
-The "strict in the accumulator" part is to ensure that in the
-AppTy equation we don't build a thunk for (fvs env t2 acc).
-
-The optimiser does do all this, but not very robustly. It depends
-critically on the basic arity-2 function not being exported, so that
-all its calls are visibly to three arguments. This analysis is
-done by the Call Arity pass.
-
-TL;DR: check this regularly!
--}
-
-
-{- *********************************************************************
-* *
- Free-var result type
-* *
-********************************************************************* -}
-
-type InterestingVarFun = Var -> Bool
-
-newtype FVRes env acc = FVRes' { runFV :: env -> acc }
- -- Caries an environment (typically empty, or a set of in-scope variables)
- -- and a composable accumulator
-
-pattern FVRes :: (env -> acc) -> FVRes env acc
-pattern FVRes f <- FVRes' f
- where
- FVRes f = FVRes' (oneShot f)
- -- oneShot: this is the core of the one-shot trick!
- -- Note [The one-shot state monad trick] in GHC.Utils.Monad.
-
-instance Semigroup a => Semigroup (FVRes env a) where
- f1 <> f2 = FVRes (\env -> runFV f1 env <> runFV f2 env)
-
-instance Monoid a => Monoid (FVRes env a) where
- mempty = FVRes (\_ -> mempty)
-
-addBndrFV :: (env -> env) -> FVRes env a -> FVRes env a
-{-# INLINE addBndrFV #-}
-addBndrFV upd f = FVRes (\bvs -> runFV f $! upd bvs)
- -- Strict application to avoid making a thunk
-
-addBndrFVRes :: TyCoVar -> FVRes BoundVars a -> FVRes BoundVars a
-addBndrFVRes tcv = addBndrFV (\bvs -> extendVarSet bvs tcv)
-
-addBndrsFVRes :: [Var] -> FVRes BoundVars a -> FVRes BoundVars a
-addBndrsFVRes tcvs = addBndrFV (\bvs -> extendVarSetList bvs tcvs)
-
-addBndrSelectiveFVRes :: TyCoVar -> FVRes (f, BoundVars) a -> FVRes (f, BoundVars) a
-addBndrSelectiveFVRes tcv
- = addBndrFV (\(f,bvs) -> let !bvs' = extendVarSet bvs tcv
- -- Strict let to avoid thunks
- in (f,bvs'))
-addBndrsSelectiveFVRes :: [Var] -> FVRes (f, BoundVars) a -> FVRes (f, BoundVars) a
-addBndrsSelectiveFVRes bs
- = addBndrFV (\(f,bvs) -> let !bvs' = extendVarSetList bvs bs
- -- Strict let to avoid thunks
- in (f,bvs'))
-
-mapUnionFVRes :: (Foldable t, Monoid acc)
- => (a -> FVRes env acc) -> t a -> FVRes env acc
-{-# INLINE mapUnionFVRes #-}
-mapUnionFVRes f xs = foldr (mappend . f) mempty xs
-
-
-type BoundVars = TyCoVarSet
-
-
-type VarSetFVRes = FVRes BoundVars (EndoOS TyCoVarSet)
-type DVarSetFVRes = FVRes BoundVars (EndoOS DTyCoVarSet)
-type SelectiveFVRes = FVRes (InterestingVarFun, BoundVars) (EndoOS DVarSet)
--- VarSetFVRes: collects a VarSet
--- DVarSetFVRes: collects a DVarSet (deterministic)
--- SelectiveFVRes: selectively collects a DVarSet
-
-type TyCoFVRes = VarSetFVRes
-type DTyCoFVRes = DVarSetFVRes
-
-runFVTop :: FVRes BoundVars a -> a
-{-# INLINE runFVTop #-}
-runFVTop f = runFV f emptyVarSet
-
-runFVAcc :: FVRes BoundVars (EndoOS a) -> a -> a
-{-# INLINE runFVAcc #-}
-runFVAcc f = runEndoOS (runFVTop f)
-
-runTyCoVars :: TyCoFVRes -> TyCoVarSet
-{-# INLINE runTyCoVars #-}
-runTyCoVars f = runFVAcc f emptyVarSet
-
-runTyCoVarsDSet :: DTyCoFVRes -> DTyCoVarSet
-{-# INLINE runTyCoVarsDSet #-}
-runTyCoVarsDSet f = runFVAcc f emptyDVarSet
-
-runFVSelective :: InterestingVarFun -> SelectiveFVRes -> DVarSet
-runFVSelective interesting f
- = runEndoOS (runFV f (interesting, emptyVarSet)) emptyDVarSet
-
-runFVSelectiveList :: InterestingVarFun -> SelectiveFVRes -> [Var]
-runFVSelectiveList interesting f = dVarSetElems (runFVSelective interesting f)
-
-runFVSelectiveSet :: InterestingVarFun -> SelectiveFVRes -> VarSet
-runFVSelectiveSet interesting f = dVarSetToVarSet (runFVSelective interesting f)
-
{- *********************************************************************
* *
@@ -429,7 +207,7 @@ tyCoVarsOfTypes tys = runTyCoVars (deepTypesFV tys)
tyCoVarsOfCo :: Coercion -> TyCoVarSet
-- The "deep" TyCoVars of the the coercion
--- See Note [Free variables of types]
+-- See Note [Computing deep free variables]
tyCoVarsOfCo co = runTyCoVars (deepCoFV co)
tyCoVarsOfMCo :: MCoercion -> TyCoVarSet
@@ -441,17 +219,17 @@ tyCoVarsOfCos cos = runTyCoVars (deepCosFV cos)
tyCoVarsOfThings :: Foldable t => (a -> Type) -> t a -> TyCoVarSet
-- Works over a collection of things from which we can extract a type
--- See Note [Free variables of types]
+-- See Note [Computing deep free variables]
tyCoVarsOfThings get_ty things
- = runTyCoVars $ mapUnionFVRes (deepTypeFV . get_ty) things
+ = runTyCoVars $ mapUnionFV (deepTypeFV . get_ty) things
-deepTypeFV :: Type -> TyCoFVRes
-deepTypesFV :: [Type] -> TyCoFVRes
-deepCoFV :: Coercion -> TyCoFVRes
-deepCosFV :: [Coercion] -> TyCoFVRes
+deepTypeFV :: Type -> TyCoFV
+deepTypesFV :: [Type] -> TyCoFV
+deepCoFV :: Coercion -> TyCoFV
+deepCosFV :: [Coercion] -> TyCoFV
(deepTypeFV, deepTypesFV, deepCoFV, deepCosFV) = foldTyCo deepTcvFolder
-deepTcvFolder :: TyCoFolder TyCoFVRes
+deepTcvFolder :: TyCoFolder TyCoFV
-- It's important that we use a one-shot EndoOS, to ensure that all
-- the free-variable finders are eta-expanded. Lacking the one-shot-ness
-- led to some big slow downs. See Note [The one-shot state monad trick]
@@ -459,22 +237,23 @@ deepTcvFolder :: TyCoFolder TyCoFVRes
deepTcvFolder = TyCoFolder { tcf_view = noView -- See Note [Free vars and synonyms]
, tcf_tyvar = do_tcv, tcf_covar = do_tcv
, tcf_hole = do_hole
- , tcf_tycobinder = addBndrFVRes }
+ , tcf_tycobinder = addBndrFV }
where
- do_tcv :: TyVar -> TyCoFVRes
- do_tcv = deepUnitFVRes deepTypeFV
+ do_tcv :: TyVar -> TyCoFV
+ do_tcv = deepUnitFV deepTypeFV
- do_hole :: CoercionHole -> TyCoFVRes
+ do_hole :: CoercionHole -> TyCoFV
do_hole hole = deepTypeFV (varType (coHoleCoVar hole))
-- We don't collect the CoercionHole itself, but we /do/
-- need to collect the free variables of its /kind/
-- See Note [CoercionHoles and coercion free variables]
-deepUnitFVRes :: (Type -> TyCoFVRes) -> TyCoVar -> TyCoFVRes
+deepUnitFV :: (Type -> TyCoFV) -> TyCoVar -> TyCoFV
-- Deal with a single TyCoVar
-- Takes a function to find free vars of the kind
-deepUnitFVRes fvs_of_kind v
- = FVRes (\bvs -> EndoOS (do_it bvs))
+-- See Note [Computing deep free variables]
+deepUnitFV fvs_of_kind v
+ = MkFV (\bvs -> EndoOS (do_it bvs))
where
do_it :: BoundVars -> TyCoVarSet -> TyCoVarSet
do_it bvs acc | v `elemVarSet` bvs = acc
@@ -490,23 +269,23 @@ deepUnitFVRes fvs_of_kind v
********************************************************************* -}
shallowTyCoVarsOfType :: Type -> TyCoVarSet
--- See Note [Free variables of types]
-shallowTyCoVarsOfType ty = runTyCoVars (shallow_ty ty)
+-- See Note [Shallow and deep free variables]
+shallowTyCoVarsOfType ty = runTyCoVars (shallowTypeFV ty)
shallowTyCoVarsOfTypes :: [Type] -> TyCoVarSet
-shallowTyCoVarsOfTypes tys = runTyCoVars (shallow_tys tys)
+shallowTyCoVarsOfTypes tys = runTyCoVars (shallowTypesFV tys)
shallowTyCoVarsOfCo :: Coercion -> TyCoVarSet
-shallowTyCoVarsOfCo co = runTyCoVars (shallow_co co)
+shallowTyCoVarsOfCo co = runTyCoVars (shallowCoFV co)
shallowTyCoVarsOfCos :: [Coercion] -> TyCoVarSet
-shallowTyCoVarsOfCos cos = runTyCoVars (shallow_cos cos)
+shallowTyCoVarsOfCos cos = runTyCoVars (shallowCosFV cos)
-- | Returns free variables of types, including kind variables as
-- a non-deterministic set. For type synonyms it does /not/ expand the
-- synonym.
shallowTyCoVarsOfTyVarEnv :: TyVarEnv Type -> TyCoVarSet
--- See Note [Free variables of types]
+-- See Note [Shallow and deep free variables]of types]
shallowTyCoVarsOfTyVarEnv tys = shallowTyCoVarsOfTypes (nonDetEltsUFM tys)
-- It's OK to use nonDetEltsUFM here because we immediately
-- forget the ordering by returning a set
@@ -516,25 +295,25 @@ shallowTyCoVarsOfCoVarEnv cos = shallowTyCoVarsOfCos (nonDetEltsUFM cos)
-- It's OK to use nonDetEltsUFM here because we immediately
-- forget the ordering by returning a set
-shallow_ty :: Type -> TyCoFVRes
-shallow_tys :: [Type] -> TyCoFVRes
-shallow_co :: Coercion -> TyCoFVRes
-shallow_cos :: [Coercion] -> TyCoFVRes
-(shallow_ty, shallow_tys, shallow_co, shallow_cos)
+shallowTypeFV :: Type -> TyCoFV
+shallowTypesFV :: [Type] -> TyCoFV
+shallowCoFV :: Coercion -> TyCoFV
+shallowCosFV :: [Coercion] -> TyCoFV
+(shallowTypeFV, shallowTypesFV, shallowCoFV, shallowCosFV)
= foldTyCo shallowTcvFolder
-shallowTcvFolder :: TyCoFolder TyCoFVRes
+shallowTcvFolder :: TyCoFolder TyCoFV
shallowTcvFolder = TyCoFolder { tcf_view = noView -- See Note [Free vars and synonyms]
, tcf_tyvar = do_tcv, tcf_covar = do_tcv
, tcf_hole = do_hole
- , tcf_tycobinder = addBndrFVRes }
+ , tcf_tycobinder = addBndrFV }
where
- do_tcv = shallowUnitFVRes
+ do_tcv = shallowUnitFV
do_hole _ = mempty -- Ignore coercion holes
-shallowUnitFVRes :: TyCoVar -> TyCoFVRes
-shallowUnitFVRes v
- = FVRes (\bvs -> EndoOS (do_it bvs))
+shallowUnitFV :: TyCoVar -> TyCoFV
+shallowUnitFV v
+ = MkFV (\bvs -> EndoOS (do_it bvs))
where
do_it bvs acc | v `elemVarSet` bvs = acc
| v `elemVarSet` acc = acc
@@ -547,71 +326,71 @@ shallowUnitFVRes v
* *
********************************************************************* -}
--- | `tyCoVarsOfTypeDSet` that returns free variables of a type in a deterministic
--- set. For explanation of why using `VarSet` is not deterministic see
--- Note [Deterministic FV] in "GHC.Utils.FV".
+-- | `tyCoVarsOfTypeDSet` that returns deep free variables of a type in a
+-- deterministic-- set. For explanation of why using `VarSet` is not deterministic
+-- see Note [Deterministic FV] in "GHC.TYpes.Var.FV".
tyCoVarsOfTypeDSet :: Type -> DTyCoVarSet
--- See Note [Free variables of types]
-tyCoVarsOfTypeDSet ty = runTyCoVarsDSet (detTyCoVarsOfType ty)
+-- See Note [Computing deep free variables]
+tyCoVarsOfTypeDSet ty = runTyCoVarsDSet (deepDetTypeFV ty)
-- | Returns free variables of types, including kind variables as
-- a deterministic set. For type synonyms it does /not/ expand the
-- synonym.
tyCoVarsOfTypesDSet :: [Type] -> DTyCoVarSet
--- See Note [Free variables of types]
-tyCoVarsOfTypesDSet tys = runTyCoVarsDSet (detTyCoVarsOfTypes tys)
+-- See Note [Computing deep free variables]
+tyCoVarsOfTypesDSet tys = runTyCoVarsDSet (deepDetTypesFV tys)
tyCoVarsOfThingsDSet :: Foldable t => (a -> Type) -> t a -> DTyCoVarSet
-- Works over a collection of things from which we can extract a type
--- See Note [Free variables of types]
+-- See Note [Computing deep free variables]
tyCoVarsOfThingsDSet get_ty things
- = runTyCoVarsDSet (mapUnionFVRes (detTyCoVarsOfType . get_ty) things)
+ = runTyCoVarsDSet (mapUnionFV (deepDetTypeFV . get_ty) things)
-- | `tyCoVarsOfTypeList` returns free variables of a type in deterministic
-- order. For explanation of why using `VarSet` is not deterministic see
--- Note [Deterministic FV] in "GHC.Utils.FV".
+-- Note [Deterministic FV] in "GHC.Types.Var.FV".
tyCoVarsOfTypeList :: Type -> [TyCoVar]
--- See Note [Free variables of types]
+-- See Note [Computing deep free variables]
tyCoVarsOfTypeList ty = dVarSetElems $ tyCoVarsOfTypeDSet ty
tyCoVarsOfCoDSet :: Coercion -> DTyCoVarSet
--- See Note [Free variables of types]
-tyCoVarsOfCoDSet ty = runTyCoVarsDSet (detTyCoVarsOfCo ty)
+-- See Note [Computing deep free variables]
+tyCoVarsOfCoDSet ty = runTyCoVarsDSet (deepDetCoFV ty)
tyCoVarsOfCoList :: Coercion -> [TyCoVar]
--- See Note [Free variables of types]
+-- See Note [Computing deep free variables]
tyCoVarsOfCoList ty = dVarSetElems $ tyCoVarsOfCoDSet ty
-- | Returns free variables of types, including kind variables as
-- a deterministically ordered list. For type synonyms it does /not/ expand the
-- synonym.
tyCoVarsOfTypesList :: [Type] -> [TyCoVar]
--- See Note [Free variables of types]
+-- See Note [Computing deep free variables]
tyCoVarsOfTypesList tys = dVarSetElems $ tyCoVarsOfTypesDSet tys
-detTyCoVarsOfType :: Type -> DTyCoFVRes
-detTyCoVarsOfTypes :: [Type] -> DTyCoFVRes
-detTyCoVarsOfCo :: Coercion -> DTyCoFVRes
-(detTyCoVarsOfType, detTyCoVarsOfTypes, detTyCoVarsOfCo, _)
- = foldTyCo deepDetTcvFolder
+deepDetTypeFV :: Type -> DTyCoFV
+deepDetTypesFV :: [Type] -> DTyCoFV
+deepDetCoFV :: Coercion -> DTyCoFV
+(deepDetTypeFV, deepDetTypesFV, deepDetCoFV, _) = foldTyCo deepDetTcvFolder
-deepDetTcvFolder :: TyCoFolder DTyCoFVRes
+deepDetTcvFolder :: TyCoFolder DTyCoFV
-- This one returns a /deterministic/ list
-- See `deepTcvFolder` for the general pattern
deepDetTcvFolder
= TyCoFolder { tcf_view = noView
, tcf_tyvar = do_tcv, tcf_covar = do_tcv
, tcf_hole = do_hole
- , tcf_tycobinder = addBndrFVRes }
+ , tcf_tycobinder = addBndrFV }
where
- do_tcv = deepDetUnitFVRes detTyCoVarsOfType
- do_hole hole = detTyCoVarsOfType (varType (coHoleCoVar hole))
+ do_tcv = deepDetUnitFV deepDetTypeFV
+ do_hole hole = deepDetTypeFV (varType (coHoleCoVar hole))
-deepDetUnitFVRes :: (Type -> DTyCoFVRes) -> TyCoVar -> DTyCoFVRes
+deepDetUnitFV :: (Type -> DTyCoFV) -> TyCoVar -> DTyCoFV
-- Deal with a single TyCoVar
-- Takes a function to find free vars of the kind
-deepDetUnitFVRes fvs_of_kind v
- = FVRes (\bvs -> EndoOS (do_it bvs))
+-- See Note [Computing deep free variables]
+deepDetUnitFV fvs_of_kind v
+ = MkFV (\bvs -> EndoOS (do_it bvs))
where
do_it :: BoundVars -> DTyCoVarSet -> DTyCoVarSet
do_it bvs acc | v `elemVarSet` bvs = acc
@@ -627,28 +406,28 @@ deepDetUnitFVRes fvs_of_kind v
someTyCoVarsOfType :: (TyCoVar -> Bool) -> Type -> [TyCoVar]
someTyCoVarsOfType interesting
- = runFVSelectiveList interesting . tyCoFVsOfType
+ = runFVSelectiveList interesting . shallowSelTypeFV
someTyCoVarsOfTypes :: (TyCoVar -> Bool) -> [Type] -> [TyCoVar]
someTyCoVarsOfTypes interesting
- = runFVSelectiveList interesting . mapUnionFVRes tyCoFVsOfType
+ = runFVSelectiveList interesting . mapUnionFV shallowSelTypeFV
-tyCoFVsOfType :: Type -> SelectiveFVRes
-tyCoFVsOfCo :: Coercion -> SelectiveFVRes
+shallowSelTypeFV :: Type -> SelectiveFV
+shallowSelCoFV :: Coercion -> SelectiveFV
-- Returns shallow free vars
--- See Note [Free variables of types]
-(tyCoFVsOfType, _, tyCoFVsOfCo, _) = foldTyCo selectiveTcvFolder
+-- See Note [Shallow and deep free variables]
+(shallowSelTypeFV, _, shallowSelCoFV, _) = foldTyCo selectiveTcvFolder
-selectiveTcvFolder :: TyCoFolder SelectiveFVRes
+selectiveTcvFolder :: TyCoFolder SelectiveFV
-- This one takes an `InterestingVarFun`, and returns shallow free vars
-- See `shallowTcvFolder` for the general pattern
selectiveTcvFolder
= TyCoFolder { tcf_view = noView -- See Note [Free vars and synonyms]
, tcf_tyvar = do_tcv, tcf_covar = do_tcv
, tcf_hole = do_hole
- , tcf_tycobinder = addBndrSelectiveFVRes }
+ , tcf_tycobinder = addBndrSelectiveFV }
where
- do_tcv v = FVRes (\bvs -> EndoOS (do_it bvs))
+ do_tcv v = MkFV (\bvs -> EndoOS (do_it bvs))
where
do_it (is_interesting,bvs) acc
| not (is_interesting v) = acc -- The "selective" bit
@@ -656,7 +435,7 @@ selectiveTcvFolder
| v `elemDVarSet` acc = acc
| otherwise = acc `extendDVarSet` v
- do_hole hole = tyCoFVsOfType (varType (coHoleCoVar hole))
+ do_hole hole = shallowSelTypeFV (varType (coHoleCoVar hole))
{- *********************************************************************
@@ -686,24 +465,24 @@ coVarsOfTypes :: [Type] -> CoVarSet
coVarsOfCo :: Coercion -> CoVarSet
coVarsOfCos :: [Coercion] -> CoVarSet
-coVarsOfType ty = runTyCoVars (deep_cv_ty ty)
-coVarsOfTypes tys = runTyCoVars (deep_cv_tys tys)
-coVarsOfCo co = runTyCoVars (deep_cv_co co)
-coVarsOfCos cos = runTyCoVars (deep_cv_cos cos)
+coVarsOfType ty = runTyCoVars (deepCoVarTypeFV ty)
+coVarsOfTypes tys = runTyCoVars (deepCoVarTypesFV tys)
+coVarsOfCo co = runTyCoVars (deepCoVarCoFV co)
+coVarsOfCos cos = runTyCoVars (deepCoVarCosFV cos)
-type CoVarFVRes = FVRes BoundVars (EndoOS CoVarSet)
+type CoVarFV = FV BoundVars (EndoOS CoVarSet)
-deep_cv_ty :: Type -> CoVarFVRes
-deep_cv_tys :: [Type] -> CoVarFVRes
-deep_cv_co :: Coercion -> CoVarFVRes
-deep_cv_cos :: [Coercion] -> CoVarFVRes
-(deep_cv_ty, deep_cv_tys, deep_cv_co, deep_cv_cos) = foldTyCo deepCoVarFolder
+deepCoVarTypeFV :: Type -> CoVarFV
+deepCoVarTypesFV :: [Type] -> CoVarFV
+deepCoVarCoFV :: Coercion -> CoVarFV
+deepCoVarCosFV :: [Coercion] -> CoVarFV
+(deepCoVarTypeFV, deepCoVarTypesFV, deepCoVarCoFV, deepCoVarCosFV) = foldTyCo deepCoVarFolder
-deepCoVarFolder :: TyCoFolder CoVarFVRes
+deepCoVarFolder :: TyCoFolder CoVarFV
deepCoVarFolder = TyCoFolder { tcf_view = noView
, tcf_tyvar = do_tyvar, tcf_covar = do_covar
, tcf_hole = do_hole
- , tcf_tycobinder = addBndrFVRes }
+ , tcf_tycobinder = addBndrFV }
where
do_tyvar _ = mempty
-- This do_tyvar means we won't see any CoVars in this
@@ -712,14 +491,14 @@ deepCoVarFolder = TyCoFolder { tcf_view = noView
-- the tyvar won't end up in the accumulator, so
-- we'd look repeatedly. Blargh.
- do_covar = deepUnitFVRes deep_cv_ty
+ do_covar = deepUnitFV deepCoVarTypeFV
do_hole hole = do_covar (coHoleCoVar hole)
-- We /do/ treat a CoercionHole as a free variable
-- See Note [CoercionHoles and coercion free variables]
-------------- Deterministic versions ------------------
-type DCoVarFVRes = FVRes BoundVars (EndoOS DCoVarSet)
+type DCoVarFV = FV BoundVars (EndoOS DCoVarSet)
coVarsOfCoDSet :: Coercion -> DCoVarSet
coVarsOfCoDSet co = runTyCoVarsDSet (det_co co)
@@ -727,23 +506,23 @@ coVarsOfCoDSet co = runTyCoVarsDSet (det_co co)
coVarsOfCosDSet :: [Coercion] -> DCoVarSet
coVarsOfCosDSet cos = runTyCoVarsDSet (det_cos cos)
-det_ty :: Type -> DCoVarFVRes
-det_co :: Coercion -> DCoVarFVRes
-det_cos :: [Coercion] -> DCoVarFVRes
+det_ty :: Type -> DCoVarFV
+det_co :: Coercion -> DCoVarFV
+det_cos :: [Coercion] -> DCoVarFV
(det_ty, _, det_co, det_cos) = foldTyCo deepDetCoVarFolder
-deepDetCoVarFolder :: TyCoFolder DCoVarFVRes
+deepDetCoVarFolder :: TyCoFolder DCoVarFV
-- Follows deepCoVarFolders, but returns a /deterministic/ set
deepDetCoVarFolder = TyCoFolder { tcf_view = noView
, tcf_tyvar = do_tyvar
, tcf_covar = do_covar
, tcf_hole = do_hole
- , tcf_tycobinder = addBndrFVRes }
+ , tcf_tycobinder = addBndrFV }
where
do_tyvar _ = mempty
- do_covar :: CoVar -> DCoVarFVRes
- do_covar = deepDetUnitFVRes det_ty
+ do_covar :: CoVar -> DCoVarFV
+ do_covar = deepDetUnitFV det_ty
do_hole hole = do_covar (coHoleCoVar hole)
@@ -768,7 +547,7 @@ closeOverKinds vs = nonDetStrictFoldVarSet do_one vs vs
closeOverKindsDSet :: DTyVarSet -> DTyVarSet
closeOverKindsDSet vs = nonDetStrictFoldDVarSet do_one vs vs
where
- do_one v = runFVAcc (detTyCoVarsOfType (varType v))
+ do_one v = runFVAcc (deepDetTypeFV (varType v))
{- --------------- Alternative version 1 (using FV) ------------
closeOverKinds = fvVarSet . closeOverKindsFV . nonDetEltsUniqSet
@@ -1033,18 +812,18 @@ injectiveVarsOfTypes :: Bool -- ^ look under injective type families?
-- in "GHC.Tc.Instance.Family".
-> [Type] -> VarSet
injectiveVarsOfTypes look_under_tfs tys
- = runTyCoVars $ mapUnionFVRes (inj_vars_of_type look_under_tfs) tys
+ = runTyCoVars $ mapUnionFV (inj_vars_of_type look_under_tfs) tys
-inj_vars_of_type :: Bool -> Type -> TyCoFVRes
+inj_vars_of_type :: Bool -> Type -> TyCoFV
inj_vars_of_type look_under_tfs = go
where
go ty | Just ty' <- rewriterView ty = go ty'
- go (TyVarTy v) = deepUnitFVRes go v
+ go (TyVarTy v) = deepUnitFV go v
go (AppTy f a) = go f `mappend` go a
go (FunTy _ w ty1 ty2) = go w `mappend` go ty1 `mappend` go ty2
go (TyConApp tc tys) = go_tc tc tys
go (ForAllTy (Bndr tv _) ty) = go (tyVarKind tv) `mappend`
- addBndrFVRes tv (go ty)
+ addBndrFV tv (go ty)
go LitTy{} = mempty
go (CastTy ty _) = go ty
go CoercionTy{} = mempty
@@ -1053,7 +832,7 @@ inj_vars_of_type look_under_tfs = go
| isTypeFamilyTyCon tc
= if | look_under_tfs
, Injective flags <- tyConInjectivityInfo tc
- -> mapUnionFVRes go $
+ -> mapUnionFV go $
filterByList (flags ++ repeat True) tys
-- Oversaturated arguments to a tycon are
-- always injective, hence the repeat True
@@ -1061,7 +840,7 @@ inj_vars_of_type look_under_tfs = go
-> mempty
| otherwise -- Data type, injective in all positions
- = mapUnionFVRes go tys
+ = mapUnionFV go tys
@@ -1110,15 +889,15 @@ invisibleVarsOfTypes = foldr (unionVarSet . invisibleVarsOfType) emptyVarSet
********************************************************************* -}
{-# INLINE afvFolder #-} -- so that specialization to (const True) works
-afvFolder :: (TyCoVar -> Bool) -> TyCoFolder (FVRes TyCoVarSet DM.Any)
+afvFolder :: (TyCoVar -> Bool) -> TyCoFolder (FV TyCoVarSet DM.Any)
-- 'afvFolder' is short for "any-free-var folder", good for checking
-- if any free var of a type satisfies a predicate `check_fv`
afvFolder check_fv = TyCoFolder { tcf_view = noView -- See Note [Free vars and synonyms]
, tcf_tyvar = do_tcv, tcf_covar = do_tcv
, tcf_hole = do_hole
- , tcf_tycobinder = addBndrFVRes }
+ , tcf_tycobinder = addBndrFV }
where
- do_tcv tv = FVRes $ \ bvs ->
+ do_tcv tv = MkFV $ \ bvs ->
Any (not (tv `elemVarSet` bvs) && check_fv tv)
do_hole _ = mempty -- I'm unsure; probably never happens
=====================================
compiler/GHC/Core/Type.hs
=====================================
@@ -159,11 +159,8 @@ module GHC.Core.Type (
liftedTypeKind, unliftedTypeKind,
-- * Type free variables
- tyCoFVsOfType,
- tyCoVarsOfType, tyCoVarsOfTypes,
- tyCoVarsOfTypeDSet,
- coVarsOfType,
- coVarsOfTypes,
+ tyCoVarsOfType, tyCoVarsOfTypes, tyCoVarsOfTypeDSet,
+ coVarsOfType, coVarsOfTypes,
anyFreeVarsOfType, anyFreeVarsOfTypes,
noFreeVarsOfType,
=====================================
compiler/GHC/Iface/Ext/Ast.hs
=====================================
@@ -23,7 +23,6 @@ import GHC.Core.DataCon ( dataConWrapperType )
import GHC.Core.Type ( Type, ForAllTyFlag(..) )
import GHC.Core.TyCon ( TyCon, tyConClass_maybe )
import GHC.Core.InstEnv
-import GHC.Core.TyCo.FVs
import GHC.Core.Predicate ( isEvId )
import GHC.Hs
@@ -40,6 +39,7 @@ import GHC.Types.Name.Reader ( RecFieldInfo(..), WithUserRdr(..) )
import GHC.Types.SrcLoc
import GHC.Types.Var ( Id, Var, EvId, varName, varType, varUnique )
import GHC.Types.Var.Env
+import GHC.Types.Var.FV
import GHC.Tc.Types
import GHC.Tc.Types.Evidence
=====================================
compiler/GHC/Tc/Gen/App.hs
=====================================
@@ -37,7 +37,6 @@ import GHC.Core.DataCon ( dataConConcreteTyVars, isNewDataCon, dataConOrigArgTys
import GHC.Core.TyCon
import GHC.Core.TyCo.Rep
import GHC.Core.TyCo.Ppr
-import GHC.Core.TyCo.FVs
import GHC.Core.TyCo.Subst ( substTyWithInScope )
import GHC.Core.Type
import GHC.Core.Coercion
@@ -47,6 +46,7 @@ import GHC.Builtin.PrimOps( tagToEnumKey )
import GHC.Builtin.Names
import GHC.Types.Var
+import GHC.Types.Var.FV
import GHC.Types.Name
import GHC.Types.Name.Env
import GHC.Types.Name.Reader
@@ -2082,7 +2082,7 @@ foldQLInstVars check_tv ty
where
(do_ty, _, _, _) = foldTyCo folder
- folder :: TyCoFolder (FVRes () a)
+ folder :: TyCoFolder (FV () a)
folder = TyCoFolder { tcf_view = noView -- See Note [Free vars and synonyms]
-- in GHC.Core.TyCo.FVs
, tcf_tyvar = do_tv, tcf_covar = mempty
@@ -2093,8 +2093,8 @@ foldQLInstVars check_tv ty
do_hole hole = do_ty (coVarKind (coHoleCoVar hole))
-- See (MIV2) in Note [Monomorphise instantiation variables]
- do_tv :: TcTyVar -> FVRes () a
- do_tv tv | isQLInstTyVar tv = FVRes $ \_ -> check_tv tv
+ do_tv :: TcTyVar -> FV () a
+ do_tv tv | isQLInstTyVar tv = MkFV $ \_ -> check_tv tv
| otherwise = mempty
{- *********************************************************************
=====================================
compiler/GHC/Tc/Types/Constraint.hs
=====================================
@@ -117,6 +117,7 @@ import GHC.Core.TyCo.FVs
import GHC.Types.Name
import GHC.Types.Var
+import GHC.Types.Var.FV
import GHC.Tc.Utils.TcType
import GHC.Tc.Types.Evidence
@@ -809,7 +810,7 @@ tyCoVarsOfCtList :: Ct -> [TcTyCoVar]
tyCoVarsOfCtList = tyCoVarsOfTypeList . ctPred
-- | Returns free variables of constraints as a deterministically ordered
--- list. See Note [Deterministic FV] in GHC.Utils.FV.
+-- list. See Note [Deterministic FV] in GHC.Types.Var.FV.
tyCoVarsOfCtEvList :: CtEvidence -> [TcTyCoVar]
tyCoVarsOfCtEvList = tyCoVarsOfTypeList . ctEvPred
@@ -819,49 +820,49 @@ tyCoVarsOfCts :: Cts -> TcTyCoVarSet
tyCoVarsOfCts = dVarSetToVarSet . runTyCoVarsDSet . tcvs_of_cts
-- | Returns free variables of a bag of constraints as a deterministically
--- ordered list. See Note [Deterministic FV] in "GHC.Utils.FV".
+-- ordered list. See Note [Deterministic FV] in "GHC.Types.Var.FV".
tyCoVarsOfCtsList :: Cts -> [TcTyCoVar]
tyCoVarsOfCtsList = dVarSetElems . tyCoVarsOfThingsDSet ctPred
-- | Returns free variables of a bag of constraints as a deterministically
--- ordered list. See Note [Deterministic FV] in GHC.Utils.FV.
+-- ordered list. See Note [Deterministic FV] in GHC.Types.Var.FV.
tyCoVarsOfCtEvsList :: [CtEvidence] -> [TcTyCoVar]
tyCoVarsOfCtEvsList = dVarSetElems . runTyCoVarsDSet
- . mapUnionFVRes (detTyCoVarsOfType . ctEvPred)
+ . mapUnionFV (deepDetTypeFV . ctEvPred)
-- | Returns free variables of WantedConstraints as a non-deterministic
--- set. See Note [Deterministic FV] in "GHC.Utils.FV".
+-- set. See Note [Deterministic FV] in "GHC.Types.Var.FV".
tyCoVarsOfWC :: WantedConstraints -> TyCoVarSet
-- Only called on *zonked* things
tyCoVarsOfWC = dVarSetToVarSet . tyCoVarsOfWcDSet
-- | Returns free variables of WantedConstraints as a deterministically
--- ordered list. See Note [Deterministic FV] in "GHC.Utils.FV".
+-- ordered list. See Note [Deterministic FV] in "GHC.Types.Var.FV".
tyCoVarsOfWCList :: WantedConstraints -> [TyCoVar]
-- Only called on *zonked* things
tyCoVarsOfWCList = dVarSetElems . tyCoVarsOfWcDSet
-- | Returns free variables of WantedConstraints as a composable FV
--- computation. See Note [Deterministic FV] in "GHC.Utils.FV".
+-- computation. See Note [Deterministic FV] in "GHC.Types.Var.FV".
tyCoVarsOfWcDSet :: WantedConstraints -> DTyCoVarSet
-- Only called on *zonked* things
tyCoVarsOfWcDSet = runTyCoVarsDSet . tcvs_of_wc
-tcvs_of_wc :: WantedConstraints -> DTyCoFVRes
+tcvs_of_wc :: WantedConstraints -> DTyCoFV
tcvs_of_wc (WC { wc_simple = simple, wc_impl = implics, wc_errors = errors })
= tcvs_of_cts simple `mappend`
- mapUnionFVRes tcvs_of_implic implics `mappend`
- mapUnionFVRes tcvs_of_errs errors
+ mapUnionFV tcvs_of_implic implics `mappend`
+ mapUnionFV tcvs_of_errs errors
-tcvs_of_cts :: Cts -> DTyCoFVRes
-tcvs_of_cts = mapUnionFVRes tcvs_of_ct
+tcvs_of_cts :: Cts -> DTyCoFV
+tcvs_of_cts = mapUnionFV tcvs_of_ct
-tcvs_of_ct :: Ct -> DTyCoFVRes
-tcvs_of_ct ct = detTyCoVarsOfType (ctPred ct)
+tcvs_of_ct :: Ct -> DTyCoFV
+tcvs_of_ct ct = deepDetTypeFV (ctPred ct)
-- | Returns free variables of Implication as a composable FV computation.
--- See Note [Deterministic FV] in "GHC.Utils.FV".
-tcvs_of_implic :: Implication -> DTyCoFVRes
+-- See Note [Deterministic FV] in "GHC.Types.Var.FV".
+tcvs_of_implic :: Implication -> DTyCoFV
-- Only called on *zonked* things
tcvs_of_implic (Implic { ic_skols = skols
, ic_given = givens
@@ -869,17 +870,17 @@ tcvs_of_implic (Implic { ic_skols = skols
| isEmptyWC wanted
= mempty
| otherwise
- = addBndrsFVRes skols $
- addBndrsFVRes givens $
+ = addBndrsFV skols $
+ addBndrsFV givens $
tcvs_of_wc wanted
-tcvs_of_errs :: DelayedError -> DTyCoFVRes
+tcvs_of_errs :: DelayedError -> DTyCoFV
tcvs_of_errs (DE_Hole hole) = tcvs_of_hole hole
tcvs_of_errs (DE_NotConcrete {}) = mempty
-tcvs_of_errs (DE_Multiplicity co _) = detTyCoVarsOfCo co
+tcvs_of_errs (DE_Multiplicity co _) = deepDetCoFV co
-tcvs_of_hole :: Hole -> DTyCoFVRes
-tcvs_of_hole (Hole { hole_ty = ty }) = detTyCoVarsOfType ty
+tcvs_of_hole :: Hole -> DTyCoFV
+tcvs_of_hole (Hole { hole_ty = ty }) = deepDetTypeFV ty
{-
************************************************************************
=====================================
compiler/GHC/Tc/Types/Evidence.hs
=====================================
@@ -64,7 +64,6 @@ import GHC.Core.Ppr () -- Instance OutputableBndr TyVar
import GHC.Core.Predicate
import GHC.Core.Type
import GHC.Core.TyCo.Rep (UnivCoProvenance(..))
-import GHC.Core.TyCo.FVs
import GHC.Core.TyCon
import GHC.Core.Make ( mkWildCase, mkRuntimeErrorApp, tYPE_ERROR_ID )
import GHC.Core.Class ( classTyCon )
@@ -80,6 +79,7 @@ import GHC.Types.Var
import GHC.Types.Id( idType )
import GHC.Types.Var.Env
import GHC.Types.Var.Set
+import GHC.Types.Var.FV
import GHC.Types.Basic
import GHC.Builtin.Names
@@ -1318,25 +1318,25 @@ nestedEvIdsOfTerm :: EvTerm -> VarSet
-- Returns only EvIds satisfying relevantEvId
nestedEvIdsOfTerm = runFVSelectiveSet isNestedEvId . evTermFVs
-evTermFVs :: EvTerm -> SelectiveFVRes
+evTermFVs :: EvTerm -> SelectiveFV
evTermFVs (EvExpr e) = exprFVs e
evTermFVs (EvTypeable _ ev) = evFVsOfTypeable ev
evTermFVs (EvFun { et_tvs = tvs, et_given = given
, et_binds = tc_ev_binds, et_body = v })
= case tc_ev_binds of
TcEvBinds {} -> mempty -- See Note [Free vars of EvFun]
- EvBinds binds -> addBndrsFV bndrs fvs
+ EvBinds binds -> addBndrsSelectiveFV bndrs fvs
where
fvs = foldr (mappend . evTermFVs . eb_rhs) (unitFV v) binds
bndrs = foldr ((:) . eb_lhs) (tvs ++ given) binds
-evTermFVss :: [EvTerm] -> SelectiveFVRes
-evTermFVss = mapUnionFVRes evTermFVs
+evTermFVss :: [EvTerm] -> SelectiveFV
+evTermFVss = mapUnionFV evTermFVs
-evFVsOfTypeable :: EvTypeable -> SelectiveFVRes
+evFVsOfTypeable :: EvTypeable -> SelectiveFV
evFVsOfTypeable ev =
case ev of
- EvTypeableTyCon _ e -> mapUnionFVRes evTermFVs e
+ EvTypeableTyCon _ e -> mapUnionFV evTermFVs e
EvTypeableTyApp e1 e2 -> evTermFVss [e1,e2]
EvTypeableTrFun em e1 e2 -> evTermFVss [em,e1,e2]
EvTypeableTyLit e -> evTermFVs e
=====================================
compiler/GHC/Tc/Utils/TcMType.hs
=====================================
@@ -1565,7 +1565,7 @@ against any specification -- just suboptimal and confounding to users.
Note [Recurring into kinds for candidateQTyVars]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-First, read Note [Closing over free variable kinds] in GHC.Core.TyCo.FVs, paying
+First, read Note [Computing deep free variables] in GHC.Core.TyCo.FVs, paying
attention to the end of the Note about using an empty bound set when
traversing a variable's kind.
@@ -1582,7 +1582,7 @@ type inference, which is seeded by the renamer and its insistence to
use different Uniques for different variables. (In contrast, the Core
functions work on the output of optimizations, which may introduce
shadowing.) Without shadowing, the problem studied by
-Note [Closing over free variable kinds] in GHC.Core.TyCo.FVs cannot happen.
+Note [Computing deep free variables] in GHC.Core.TyCo.FVs cannot happen.
Why it is necessary:
Wiping the bound set would be just plain wrong here. Consider
@@ -1593,7 +1593,7 @@ We really don't want to think k1 and k2 are free here. (It's true that we'll
never be able to fill in `hole`, but we don't want to go off the rails just
because we have an insoluble coercion hole.) So: why is it wrong to wipe
the bound variables here but right in Core? Because the final statement
-in Note [Closing over free variable kinds] in GHC.Core.TyCo.FVs is wrong: not
+in Note [Computing deep free variables] in GHC.Core.TyCo.FVs is wrong: not
every variable is either free or bound. A variable can be a hole, too!
The reasoning in that Note then breaks down.
=====================================
compiler/GHC/Tc/Utils/TcType.hs
=====================================
@@ -219,16 +219,17 @@ import {-# SOURCE #-} GHC.Tc.Types.Origin
( SkolemInfo, unkSkol
, FixedRuntimeRepOrigin, FixedRuntimeRepContext )
--- others:
+import GHC.Types.Var.FV
import GHC.Types.Name as Name
-- We use this to make dictionaries for type literals.
-- Perhaps there's a better way to do this?
import GHC.Types.Name.Env
import GHC.Types.Name.Set
+import GHC.Types.Basic
+
import GHC.Builtin.Names
import GHC.Builtin.Types ( coercibleClass, eqClass, heqClass, unitTyConKey
, listTyCon, constraintKind )
-import GHC.Types.Basic
import GHC.Data.Maybe
import GHC.Data.List.SetOps ( getNth, findDupsEq )
@@ -1178,11 +1179,11 @@ exactTyCoVarsOfTypes :: [Type] -> TyCoVarSet
exactTyCoVarsOfType ty = runTyCoVars (exact_ty ty)
exactTyCoVarsOfTypes tys = runTyCoVars (exact_tys tys)
-exact_ty :: Type -> TyCoFVRes
-exact_tys :: [Type] -> TyCoFVRes
+exact_ty :: Type -> TyCoFV
+exact_tys :: [Type] -> TyCoFV
(exact_ty, exact_tys, _, _) = foldTyCo exactTcvFolder
-exactTcvFolder :: TyCoFolder TyCoFVRes
+exactTcvFolder :: TyCoFolder TyCoFV
exactTcvFolder = deepTcvFolder { tcf_view = coreView }
-- This is the key line
=====================================
compiler/GHC/Tc/Utils/Unify.hs
=====================================
@@ -101,6 +101,7 @@ import GHC.Types.Id( idType )
import GHC.Types.Var as Var
import GHC.Types.Var.Set
import GHC.Types.Var.Env
+import GHC.Types.Var.FV
import GHC.Types.Basic
import GHC.Types.Unique.Set (nonDetEltsUniqSet)
@@ -3572,20 +3573,20 @@ mkOccFolders :: Name -> (TcType -> Bool, TcCoercion -> Bool)
mkOccFolders lhs_tv = ( getAny . runFVTop . check_ty
, getAny . runFVTop . check_co)
where
- check_ty :: Type -> FVRes BoundVars Any
+ check_ty :: Type -> FV BoundVars Any
!(check_ty, _, check_co, _) = foldTyCo occ_folder
- occ_folder :: TyCoFolder (FVRes BoundVars Any)
+ occ_folder :: TyCoFolder (FV BoundVars Any)
occ_folder = TyCoFolder { tcf_view = noView -- Don't expand synonyms
, tcf_tyvar = do_tcv, tcf_covar = do_tcv
, tcf_hole = do_hole
- , tcf_tycobinder = addBndrFVRes }
+ , tcf_tycobinder = addBndrFV }
- do_tcv v = (FVRes $ \ bvs ->
+ do_tcv v = (MkFV $ \ bvs ->
Any (not (v `elemVarSet` bvs) && tyVarName v == lhs_tv))
`mappend` check_ty (varType v)
- do_hole _hole = FVRes $ \ _bvs -> DM.Any True -- Reject coercion holes
+ do_hole _hole = MkFV $ \ _bvs -> DM.Any True -- Reject coercion holes
{- *********************************************************************
* *
=====================================
compiler/GHC/Utils/EndoOS.hs
=====================================
@@ -1,12 +1,13 @@
{-# LANGUAGE PatternSynonyms #-}
-- | One-shot endomorphisms
--- Mostly for backwards compatibility.
-- One-shot endomorphisms
-- Like GHC.Internal.Data.Semigroup.Internal.Endo, but using
-- the one-shot trick from
-- Note [The one-shot state monad trick] in GHC.Utils.Monad.
+--
+-- It is also strict: see the (<>) method in he Semigroup instance
module GHC.Utils.EndoOS( EndoOS(EndoOS, runEndoOS ), foldEndoOS ) where
@@ -19,13 +20,21 @@ newtype EndoOS a = EndoOS' { runEndoOS :: a -> a }
instance Semigroup (EndoOS a) where
- f <> g = EndoOS (\x -> runEndoOS f $! (runEndoOS g x))
- -- Strict application, to avoid thunk creation
+ EndoOS' f <> EndoOS' g = EndoOS (\x -> g $! f x)
+ -- NB1: Strict application, to avoid thunk creation
+ -- See (FV3) in Note [Finding free variables]
+ -- in GHC.Types.Var.FV
+ -- NB2: We apply `f` to the acccumulator first, then `g`
+ -- So if we traverse a type left-to-right, the insertion
+ -- order for (say) free type variables is left-to-right
+ -- See (FV4) in Note [Finding free variables]
+ -- in GHC.Types.Var.FV
instance Monoid (EndoOS a) where
mempty = EndoOS id
pattern EndoOS :: (a->a) -> EndoOS a
+{-# COMPLETE EndoOS #-}
pattern EndoOS f <- EndoOS' f
where
EndoOS f = EndoOS' (oneShot f)
=====================================
compiler/GHC/Utils/FV.hs deleted
=====================================
@@ -1,202 +0,0 @@
-{-
-(c) Bartosz Nitka, Facebook 2015
-
--}
-
--- | Utilities for efficiently and deterministically computing free variables.
-module GHC.Utils.FV (
- -- * Deterministic free vars computations
- FV, InterestingVarFun,
-
- -- * Running the computations
- fvVarList, fvVarSet, fvDVarSet,
-
- -- ** Manipulating those computations
- unitFV,
- emptyFV,
- mkFVs,
- unionFV,
- unionsFV,
- delFV,
- delFVs,
- filterFV,
- mapUnionFV,
- fvDVarSetSome,
- ) where
-
-import GHC.Prelude
-
-import GHC.Types.Var
-import GHC.Types.Var.Set
-
--- | Predicate on possible free variables: returns @True@ iff the variable is
--- interesting
-type InterestingVarFun = Var -> Bool
-
--- Note [Deterministic FV]
--- ~~~~~~~~~~~~~~~~~~~~~~~
--- When computing free variables, the order in which you get them affects
--- the results of floating and specialization. If you use UniqFM to collect
--- them and then turn that into a list, you get them in nondeterministic
--- order as described in Note [Deterministic UniqFM] in GHC.Types.Unique.DFM.
-
--- A naive algorithm for free variables relies on merging sets of variables.
--- Merging costs O(n+m) for UniqFM and for UniqDFM there's an additional log
--- factor. It's cheaper to incrementally add to a list and use a set to check
--- for duplicates.
-type FV = InterestingVarFun -- Used for filtering sets as we build them
- -> VarSet -- Locally bound variables
- -> VarAcc -- Accumulator
- -> VarAcc
-
-type VarAcc = ([Var], VarSet) -- List to preserve ordering and set to check for membership,
- -- so that the list doesn't have duplicates
- -- For explanation of why using `VarSet` is not deterministic see
- -- Note [Deterministic UniqFM] in GHC.Types.Unique.DFM.
-
--- Note [FV naming conventions]
--- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--- To get the performance and determinism that FV provides, FV computations
--- need to built up from smaller FV computations and then evaluated with
--- one of `fvVarList`, `fvDVarSet` That means the functions
--- returning FV need to be exported.
---
--- The conventions are:
---
--- a) non-deterministic functions:
--- * a function that returns VarSet
--- e.g. `tyVarsOfType`
--- b) deterministic functions:
--- * a worker that returns FV
--- e.g. `tyFVsOfType`
--- * a function that returns [Var]
--- e.g. `tyVarsOfTypeList`
--- * a function that returns DVarSet
--- e.g. `tyVarsOfTypeDSet`
---
--- Where tyVarsOfType, tyVarsOfTypeList, tyVarsOfTypeDSet are implemented
--- in terms of the worker evaluated with fvVarSet, fvVarList, fvDVarSet
--- respectively.
-
--- | Run a free variable computation, returning a list of distinct free
--- variables in deterministic order and a non-deterministic set containing
--- those variables.
-fvVarAcc :: FV -> ([Var], VarSet)
-fvVarAcc fv = fv (const True) emptyVarSet ([], emptyVarSet)
-
--- | Run a free variable computation, returning a list of distinct free
--- variables in deterministic order.
-fvVarList :: FV -> [Var]
-fvVarList = fst . fvVarAcc
-
--- | Run a free variable computation, returning a deterministic set of free
--- variables. Note that this is just a wrapper around the version that
--- returns a deterministic list. If you need a list you should use
--- `fvVarList`.
-fvDVarSet :: FV -> DVarSet
-fvDVarSet = mkDVarSet . fvVarList
-
--- | Run a free variable computation, returning a non-deterministic set of
--- free variables. Don't use if the set will be later converted to a list
--- and the order of that list will impact the generated code.
-fvVarSet :: FV -> VarSet
-fvVarSet = snd . fvVarAcc
-
--- Note [FV eta expansion]
--- ~~~~~~~~~~~~~~~~~~~~~~~
--- Let's consider an eta-reduced implementation of freeVarsOf using FV:
---
--- freeVarsOf (App a b) = freeVarsOf a `unionFV` freeVarsOf b
---
--- If GHC doesn't eta-expand it, after inlining unionFV we end up with
---
--- freeVarsOf = \x ->
--- case x of
--- App a b -> \fv_cand in_scope acc ->
--- freeVarsOf a fv_cand in_scope $! freeVarsOf b fv_cand in_scope $! acc
---
--- which has to create a thunk, resulting in more allocations.
---
--- On the other hand if it is eta-expanded:
---
--- freeVarsOf (App a b) fv_cand in_scope acc =
--- (freeVarsOf a `unionFV` freeVarsOf b) fv_cand in_scope acc
---
--- after inlining unionFV we have:
---
--- freeVarsOf = \x fv_cand in_scope acc ->
--- case x of
--- App a b ->
--- freeVarsOf a fv_cand in_scope $! freeVarsOf b fv_cand in_scope $! acc
---
--- which saves allocations.
---
--- GHC when presented with knowledge about all the call sites, correctly
--- eta-expands in this case. Unfortunately due to the fact that freeVarsOf gets
--- exported to be composed with other functions, GHC doesn't have that
--- information and has to be more conservative here.
---
--- Hence functions that get exported and return FV need to be manually
--- eta-expanded. See also #11146.
-
--- | Add a variable - when free, to the returned free variables.
--- Ignores duplicates and respects the filtering function.
-unitFV :: Id -> FV
-unitFV var fv_cand in_scope acc@(have, haveSet)
- | var `elemVarSet` in_scope = acc
- | var `elemVarSet` haveSet = acc
- | fv_cand var = (var:have, extendVarSet haveSet var)
- | otherwise = acc
-{-# INLINE unitFV #-}
-
--- | Return no free variables.
-emptyFV :: FV
-emptyFV _ _ acc = acc
-{-# INLINE emptyFV #-}
-
--- | Union two free variable computations.
-unionFV :: FV -> FV -> FV
-unionFV fv1 fv2 fv_cand in_scope acc =
- fv1 fv_cand in_scope $! fv2 fv_cand in_scope $! acc
-{-# INLINE unionFV #-}
-
--- | Mark the variable as not free by putting it in scope.
-delFV :: Var -> FV -> FV
-delFV var fv fv_cand !in_scope acc =
- fv fv_cand (extendVarSet in_scope var) acc
-{-# INLINE delFV #-}
-
--- | Mark many free variables as not free.
-delFVs :: VarSet -> FV -> FV
-delFVs vars fv fv_cand !in_scope acc =
- fv fv_cand (in_scope `unionVarSet` vars) acc
-{-# INLINE delFVs #-}
-
--- | Filter a free variable computation.
-filterFV :: InterestingVarFun -> FV -> FV
-filterFV fv_cand2 fv fv_cand1 in_scope acc =
- fv (\v -> fv_cand1 v && fv_cand2 v) in_scope acc
-{-# INLINE filterFV #-}
-
--- | Map a free variable computation over a list and union the results.
-mapUnionFV :: (a -> FV) -> [a] -> FV
-mapUnionFV _f [] _fv_cand _in_scope acc = acc
-mapUnionFV f (a:as) fv_cand in_scope acc =
- mapUnionFV f as fv_cand in_scope $! f a fv_cand in_scope $! acc
-{-# INLINABLE mapUnionFV #-}
-
--- | Union many free variable computations.
-unionsFV :: [FV] -> FV
-unionsFV fvs fv_cand in_scope acc = mapUnionFV id fvs fv_cand in_scope acc
-{-# INLINE unionsFV #-}
-
--- | Add multiple variables - when free, to the returned free variables.
--- Ignores duplicates and respects the filtering function.
-mkFVs :: [Var] -> FV
-mkFVs vars fv_cand in_scope acc =
- mapUnionFV unitFV vars fv_cand in_scope acc
-{-# INLINE mkFVs #-}
-
-fvDVarSetSome :: InterestingVarFun -> FV -> DVarSet
-fvDVarSetSome interesting_var fv =
- mkDVarSet $ fst $ fv interesting_var emptyVarSet ([], emptyVarSet)
=====================================
compiler/ghc.cabal.in
=====================================
@@ -951,6 +951,7 @@ Library
GHC.Types.Var
GHC.Types.Var.Env
GHC.Types.Var.Set
+ GHC.Types.Var.FV
GHC.Unit
GHC.Unit.Env
GHC.Unit.External
@@ -992,7 +993,6 @@ Library
GHC.Utils.EndoOS
GHC.Utils.Exception
GHC.Utils.Fingerprint
- GHC.Utils.FV
GHC.Utils.GlobalVars
GHC.Utils.IO.Unsafe
GHC.Utils.Json
=====================================
utils/haddock/haddock-api/src/Haddock/GhcUtils.hs
=====================================
@@ -43,7 +43,8 @@ import qualified Data.Set as Set
import GHC hiding (HsTypeGhcPsExt (..))
import GHC.Builtin.Types (liftedRepTy)
import GHC.Core.TyCo.Rep (Type (..))
-import GHC.Core.Type (binderVar, isRuntimeRepVar)
+import GHC.Core.TyCo.FVs ( deepDetTypesFV )
+import GHC.Core.Type (isRuntimeRepVar)
import GHC.Data.StringBuffer (StringBuffer)
import qualified GHC.Data.StringBuffer as S
import GHC.Driver.Session
@@ -52,17 +53,11 @@ import GHC.Types.Name
import GHC.Types.SrcLoc (advanceSrcLoc)
import GHC.Types.SourceText (SourceText(..))
import GHC.Types.Var
- ( Specificity
- , TyVarBinder
- , VarBndr (..)
- , isInvisibleForAllTyFlag
- , tyVarKind
- , updateTyVarKind
- )
-import GHC.Types.Var.Env (TyVarEnv, elemVarEnv, emptyVarEnv, extendVarEnv)
-import GHC.Types.Var.Set (VarSet, emptyVarSet)
-import GHC.Utils.FV as FV
+import GHC.Types.Var.Env
+import GHC.Types.Var.Set
+import GHC.Types.Var.FV
import GHC.Utils.Outputable (Outputable, SDocContext, ppr)
+import GHC.Utils.EndoOS
import qualified GHC.Utils.Outputable as Outputable
import GHC.Utils.Panic (panic)
@@ -86,6 +81,7 @@ filterSigNames p orig@(SpecSig _ n _ _) = ifTrueJust (p $ unLoc n) orig
filterSigNames p orig@(InlineSig _ n _) = ifTrueJust (p $ unLoc n) orig
filterSigNames p (FixSig _ (FixitySig ns_spec ns ty)) =
case filter (p . unLoc) ns of
+
[] -> Nothing
filtered -> Just (FixSig noAnn (FixitySig ns_spec filtered ty))
filterSigNames _ orig@(MinimalSig _ _) = Just orig
@@ -817,66 +813,14 @@ isTypeHidden expInfo = typeHidden
-- | Get free type variables in a 'Type' in their order of appearance.
-- See [Ordering of implicit variables].
orderedFVs
- :: VarSet
- -- ^ free variables to ignore
- -> [Type]
- -- ^ types to traverse (in order) looking for free variables
- -> [TyVar]
- -- ^ free type variables, in the order they appear in
-orderedFVs vs tys =
- reverse . fst $ tyCoFVsOfTypes' tys (const True) vs ([], emptyVarSet)
-
--- See the "Free variables of types and coercions" section in 'TyCoRep', or
--- check out Note [Free variables of types]. The functions in this section
--- don't output type variables in the order they first appear in in the 'Type'.
---
--- For example, 'tyCoVarsOfTypeList' reports an incorrect order for the type
--- of 'const :: a -> b -> a':
---
--- >>> import GHC.Types.Name
--- >>> import TyCoRep
--- >>> import GHC.Builtin.Types.Prim
--- >>> import GHC.Types.Var
--- >>> a = TyVarTy alphaTyVar
--- >>> b = TyVarTy betaTyVar
--- >>> constTy = mkFunTys [a, b] a
--- >>> map (getOccString . tyVarName) (tyCoVarsOfTypeList constTy)
--- ["b","a"]
---
--- However, we want to reuse the very optimized traversal machinery there, so
--- so we make our own `tyCoFVsOfType'`, `tyCoFVsBndr'`, and `tyCoVarsOfTypes'`.
--- All these do differently is traverse in a different order and ignore
--- coercion variables.
-
--- | Just like 'tyCoFVsOfType', but traverses type variables in reverse order
--- of appearance.
-tyCoFVsOfType' :: Type -> FV
-tyCoFVsOfType' (TyVarTy v) a b c = (FV.unitFV v `unionFV` tyCoFVsOfType' (tyVarKind v)) a b c
-tyCoFVsOfType' (TyConApp _ tys) a b c = tyCoFVsOfTypes' tys a b c
-tyCoFVsOfType' (LitTy{}) a b c = emptyFV a b c
-tyCoFVsOfType' (AppTy fun arg) a b c = (tyCoFVsOfType' arg `unionFV` tyCoFVsOfType' fun) a b c
-tyCoFVsOfType' (FunTy _ w arg res) a b c =
- ( tyCoFVsOfType' res
- `unionFV` tyCoFVsOfType' w
- `unionFV` tyCoFVsOfType' arg
- )
- a
- b
- c
-tyCoFVsOfType' (ForAllTy bndr ty) a b c = tyCoFVsBndr' bndr (tyCoFVsOfType' ty) a b c
-tyCoFVsOfType' (CastTy ty _) a b c = (tyCoFVsOfType' ty) a b c
-tyCoFVsOfType' (CoercionTy _) a b c = emptyFV a b c
-
--- | Just like 'tyCoFVsOfTypes', but traverses type variables in reverse order
--- of appearance.
-tyCoFVsOfTypes' :: [Type] -> FV
-tyCoFVsOfTypes' (ty : tys) fv_cand in_scope acc = (tyCoFVsOfTypes' tys `unionFV` tyCoFVsOfType' ty) fv_cand in_scope acc
-tyCoFVsOfTypes' [] fv_cand in_scope acc = emptyFV fv_cand in_scope acc
-
--- | Just like 'tyCoFVsBndr', but traverses type variables in reverse order of
--- appearance.
-tyCoFVsBndr' :: TyVarBinder -> FV -> FV
-tyCoFVsBndr' (Bndr tv _) fvs = FV.delFV tv fvs `unionFV` tyCoFVsOfType' (tyVarKind tv)
+ :: VarSet -- ^ Free variables to ignore
+ -> [Type] -- ^ Types to traverse (in order) looking for free variables
+ -> [TyVar] -- ^ Free type variables, /in the order in which they appear/
+orderedFVs ignore_tvs tys
+ = dVarSetElems (runEndoOS (runFV get_fvs ignore_tvs) emptyDVarSet)
+ where
+ get_fvs :: DVarSetFV
+ get_fvs = deepDetTypesFV tys
-------------------------------------------------------------------------------
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d3f56f61a8433319d611f292ddae0c1…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d3f56f61a8433319d611f292ddae0c1…
You're receiving this email because of your account on gitlab.haskell.org.
1
0