2.1. Version 10.0.1¶
The significant changes to the various parts of the compiler are listed in the following sections. See the migration guide on the GHC Wiki for specific guidance on migrating programs to this release.
2.1.1. Language¶
The default language edition has been bumped to
GHC2024, as per the accepted GHC proposal 632 (#26039).Fix a bug introduced in GHC 9.10 where GHC would erroneously accept infix uses of promoted data constructors without enabling
DataKinds. As a result, you may need to enableDataKindsin code that did not previously require it.TypeandConstraintare now (at last) completely distinct types, just as much asIntandBool. For example, you can now write:type family F a type instance F Type = Int type instance F Constraint = Bool
which was previously rejected with “Conflicting family instance declarations”.
The extension
ExplicitNamespacesnow allows namespace-specified wildcardstype ..anddata ..in import and export lists.Implicit parameters and
ImpredicativeTypes. GHC now knows that if?foo::Sis coecible to?foo::Tonly ifSis coercible toT. Example (from #26737):{-# LANGUAGE ImplicitParams, ImpredicativeTypes #-} newtype N = MkN Int test :: ((?foo::N) => Bool) -> ((?foo::Int) => Bool) test = coerce
This is achieved by arranging that
?foo :: Thas a representational role forT.Implement
-XQualifiedStrings(proposal)The experimental
Modifiersextension now allows%foosyntax to attach types to various places in the syntax tree.Some previously-valid uses of
LinearTypesare now rejected, since its syntax has been generalized for use withModifiers. In particular, some kind annotations must be added:f :: Int %m -> Int -- no longer accepted f :: forall (m :: Multiplicity). Int %m -> Int -- still accepted
Alternatively, most previously-valid code can still be accepted by setting
-XLinearTypes -XNoModifiers. But this doesn’t reliably work with-XStrict, and sometimes parentheses must be added:let %1 x:xs = ... in ... -- previously accepted with -XLinearTypes -XStrict let %1 (x:xs) = ... in ... -- still accepeted let %1 Just x = ... in ... -- previously accepted with -XLinearTypes -XStrict let %1 (Just x) = ... in ... -- still accepeted
-XLinearTypes -XNoModifiersdoesn’t accept the old versions, because modifiers now bind tighter than constructors. The first now parses aslet (%1 x):xs = ... in ..., and the second no longer parses at all.The treatment of static forms has been simplified, implementing GHC proposal 732 (#26556). There is a new, simple rule for
(static e), namely that the free term variables ofemust be bound at top level. This also fixes #26545, #24464, #24773, #16981, #26466 and #27664.Allow kinds of the form
k -> *and* -> kto occur in expression syntax, i.e. to be used as required type arguments (#26587, #26967). For example:{-# LANGUAGE RequiredTypeArguments, StarIsType #-} x1 = f (* -> * -> *) x2 = f (forall k. k -> *) x3 = f ((* -> *) -> Constraint)
Infix holes (
t1 `_` t2) are now permitted in types, following the precedent set by term-level expressions (#11107). Error messages for illegal promotion ticks are now reported at more precise source locations.List comprehensions are now considered to be completely non-linear under
LinearTypes(#25081).
2.1.2. Compiler¶
-fpolymorphic-specialisationis now switched on by default (#23559).Code coverage’s (
-fhpc) treatment of record fields now extends beyond record fields accessed viaRecordWildCardsandNamedFieldPuns, and also handles access to nested record fields. That is, in a pattern such asFoo{bar = Bar{baz = b}}bothbarandbazwill now be marked as covered ifbis evaluated. Note that this currently only works when record fields (or values contained within them) are bound to variables. The very similar patternFoo{bar = Bar{baz = 42}}will will not yet markbarorbazas covered.Pattern synonyms can now be suggested as valid hole fits (except, of course, if they are unidirectional). Valid hole fits also now use deep subsumption for data constructors, matching up multiplicities (#26338).
GHC uses the information from the definition of a closed type family to generate some extra functional dependencies for type equalities involving that type family. As a consequence:
When multiple
-msse*flags are given, the maximum version takes effect. For example,-msse4.2 -msse2is now equivalent to-msse4.2. Previously, only the last flag took effect.Some x86 architecture flags now imply other flags. For example,
-mavxnow implies-msse4.2, and-mavx512fnow implies-mfmain addition to-mavx2. Refer to the users’ guide for more details about each individual flag.The flag
-fhide-source-pathsis enabled by default at verbosity level 1 and below by default. This improves the readability of the compiler output, as we transition from:[ 1 of 139] Compiling Distribution.Compat.Binary ( src/Distribution/Compat/Binary.hs, /home/tchoutri/Code/cabal/dist-newstyle/build/x86_64-linux/ghc-9.12.2/Cabal-syntax-3.17.0.0/build/Distribution/Compat/Binary.o, /home/tchoutri/Code/cabal/dist-newstyle/build/x86_64-linux/ghc-9.12.2/Cabal-syntax-3.17.0.0/build/Distribution/Compat/Binary.dyn_o ) [ 2 of 139] Compiling Distribution.Compat.Exception ( src/Distribution/Compat/Exception.hs, /home/tchoutri/Code/cabal/dist-newstyle/build/x86_64-linux/ghc-9.12.2/Cabal-syntax-3.17.0.0/build/Distribution/Compat/Exception.o, /home/tchoutri/Code/cabal/dist-newstyle/build/x86_64-linux/ghc-9.12.2/Cabal-syntax-3.17.0.0/build/Distribution/Compat/Exception.dyn_o ) [ 3 of 139] Compiling Distribution.Compat.Newtype ( src/Distribution/Compat/Newtype.hs, /home/tchoutri/Code/cabal/dist-newstyle/build/x86_64-linux/ghc-9.12.2/Cabal-syntax-3.17.0.0/build/Distribution/Compat/Newtype.o, /home/tchoutri/Code/cabal/dist-newstyle/build/x86_64-linux/ghc-9.12.2/Cabal-syntax-3.17.0.0/build/Distribution/Compat/Newtype.dyn_o ) [ 4 of 139] Compiling Distribution.Compat.Semigroup ( src/Distribution/Compat/Semigroup.hs, /home/tchoutri/Code/cabal/dist-newstyle/build/x86_64-linux/ghc-9.12.2/Cabal-syntax-3.17.0.0/build/Distribution/Compat/Semigroup.o, /home/tchoutri/Code/cabal/dist-newstyle/build/x86_64-linux/ghc-9.12.2/Cabal-syntax-3.17.0.0/build/Distribution/Compat/Semigroup.dyn_o ) [ 5 of 139] Compiling Distribution.PackageDescription.Utils ( src/Distribution/PackageDescription/Utils.hs, /home/tchoutri/Code/cabal/dist-newstyle/build/x86_64-linux/ghc-9.12.2/Cabal-syntax-3.17.0.0/build/Distribution/PackageDescription/Utils.o, /home/tchoutri/Code/cabal/dist-newstyle/build/x86_64-linux/ghc-9.12.2/Cabal-syntax-3.17.0.0/build/Distribution/PackageDescription/Utils.dyn_o ) [ 6 of 139] Compiling Distribution.Utils.Base62 ( src/Distribution/Utils/Base62.hs, /home/tchoutri/Code/cabal/dist-newstyle/build/x86_64-linux/ghc-9.12.2/Cabal-syntax-3.17.0.0/build/Distribution/Utils/Base62.o, /home/tchoutri/Code/cabal/dist-newstyle/build/x86_64-linux/ghc-9.12.2/Cabal-syntax-3.17.0.0/build/Distribution/Utils/Base62.dyn_o ) [ 7 of 139] Compiling Distribution.Utils.MD5 ( src/Distribution/Utils/MD5.hs, /home/tchoutri/Code/cabal/dist-newstyle/build/x86_64-linux/ghc-9.12.2/Cabal-syntax-3.17.0.0/build/Distribution/Utils/MD5.o, /home/tchoutri/Code/cabal/dist-newstyle/build/x86_64-linux/ghc-9.12.2/Cabal-syntax-3.17.0.0/build/Distribution/Utils/MD5.dyn_o )
to
[ 1 of 139] Compiling Distribution.Compat.Binary [ 2 of 139] Compiling Distribution.Compat.Exception [ 3 of 139] Compiling Distribution.Compat.Newtype [ 4 of 139] Compiling Distribution.Compat.Semigroup [ 5 of 139] Compiling Distribution.PackageDescription.Utils [ 6 of 139] Compiling Distribution.Utils.Base62 [ 7 of 139] Compiling Distribution.Utils.MD5
See #25345.
Add several options for x86 extensions:
-mavx512bw,-mavx512dq,-mavx512vl, and-mgfni.Improved treatment of floating-point in constant folding. GHC will now preserve the sign of zero and NaN payloads during constant folding, fixing #9811 and #21227.
As a side effect,
x + 0will no longer be constant-folded tox, because-0 + 0 = 0, where-0is the IEEE-754 negative zero floating point constant. Instead, it isx + -0that is constant-folded tox.SIMD support has been added to the AArch64 Native Code Generator. Currently, 128-bit wide vectors are supported via ASIMD (also known as NEON).
Added the
-fwrite-byte-codeoption which makes GHC emit a.gbcfile which contains a serialised representation of bytecode.The bytecode can be loaded by the compiler to avoid having to reinterpret a module when using the bytecode interpreter (for example, in GHCi).
There are also the new options:
-gbcdir ⟨dir⟩: Specify the directory to place the gbc files-gbcsuf ⟨suffix⟩: Specify the suffix for gbc files
The option
-fbyte-code-and-object-codenow implies-fwrite-byte-code.Added support for building bytecode libraries. A bytecode library is a collection of bytecode files (
.gbc) and a library which combines together additional object files. A bytecode library is created by invoking GHC with the-bytecodelibflag.A bytecode library can be used to satisfy a package dependency when using the interpreter. If a user enables
-fprefer-byte-code, then if a package provides a bytecode library, that will be loaded and used to satisfy the dependency (#26298).Support statically linking executables properly (#26434). This does a number of things:
Makes GHC aware of
extra-libraries-static(this changes the package database format).Adds a switch
-static-externalthat will honourextra-libraries-staticto link external system dependencies statically. See also-exclude-static-external ⟨lib1,lib2,...⟩.Adds a new field to settings/targets: “ld supports verbatim namespace”.
Adds a switch
-fully-staticthat is meant as a high-level interface for e.g. cabal. This also honoursextra-libraries-static.
Warn when
-dynamicis mixed with-staticlib.GHC now builds the external interpreter program on demand when it is missing (#24731).
iservhas been removed from the tree completely: Hadrian no longer builds or distributesiserv, and the GHC driver uses the on-demand external interpreter by default when invoked with-fexternal-interpreter, without needing to specify-pgmi "". The on-demand external interpreter program is linked with the threaded RTS if it is available in the target RTS ways.Support larger unboxed sums: the known constructor encoding for sums in interfaces now uses 11 bits for both the arity and the alternative (up from 8 and 6, respectively).
Changed the way data constructors are typechecked, in particular how multiplicities are made to line up (#26072, #26311).
The LoongArch64 native code generator now supports finer-grained
DBARhints on LA664 and newer microarchitectures, including for atomic writes, implementsMO_BSwapandMO_BRevwith bit-manipulation instructions, and addscmpxchgandxchgprimops. The new-mla664flag enables the LA664 instructions. LA464 remains the default.Fixed implicit lifting to use a precise level check (#26088).
-fdiagnostics-as-jsonoutput now includes the rendered diagnostic message, in the same format GHC would produce without the flag (#26173).-fdiagnostics-as-jsonis now respected for error messages from pre-processors (#25480), for Core diagnostics and for driver diagnostics (see #24113).Changed the error message of
ghcExitfrom<no location info>: error: Compilation had errorstoCompilation had errors.Handle non-fractional
CmmFloatliterals (infinity and NaN) in Cmm’s common block eliminator (#26229).Allow defining
HasFieldinstances for naughty fields (#26295).Don’t warn about unused imports when a generated import is used (#21730).
Serialize wired-in names as external names when creating HIE files (#26238).
Fixed the simplifier firing rules or inlinings that are not active throughout the whole activation range of a RULE or stable unfolding when simplifying its right-hand side (#26323).
Non-pointer fields of data constructors are now sorted by size, always storing the largest field first, which reduces wasted padding/alignment space in closures with differently sized fields. Unboxed sums with a small enough number of constructors now use
Word8,Word16orWord32for the tag field.Typechecker plugins (and defaulting plugins) are now run during pattern-match checking, which significantly improves pattern-match warnings for programs that rely on typechecking plugins in order to typecheck (e.g. dealing with GADTs indexed by natural numbers and using natural number arithmetic) (#26395).
Core plugins can now access unoptimized Core: the first simple optimization pass after desugaring is now a real
CoreToDopass, which allowsCorePlugins to decide whether they want to be executed before or after this pass (#23337).Added the
-dno-builtin-rulesand-dno-bignum-rulesdebug flags to disable built-in rules and bignum rules respectively (#20298).Fixed LLVM linking of Intel BMI intrinsics
pdep{8,16}andpext{8,16}(#26065).Fixed a regression that caused overloaded functions to no longer be specialised as effectively as in previous releases, hurting runtime performance (#26831).
Warn when
-finfo-table-mapis used with-fllvm, as these are currently not supported together (#26435).The driver now recognises
.dyn_ofiles as object files when passed on the command line, fixing plugins compiled with this suffix (#24486).Fixed
-dsuppress-uniquesto also suppress the unique of free variables shown in demand signatures (#27106).Improved the detection of custom type errors in equality constraints, which improves detection of redundant pattern match warnings (#26400).
Introduced
-fno-distinct-constructor-tablesand-fdistinct-constructor-tables-only=⟨cs⟩, to only generate distinct constructor tables for specific constructors (#23703).Fixed typechecking of pattern synonym declarations without a type signature that contain unfilled metavariables (#26465).
Added hints and explanations for unsolved
HasFieldconstraints, such as similar name suggestions and import suggestions (#18776, #22382, #26480).Improved compiler performance by making
OccAnalstricter, reducing residency and improving compile times.Fixed an oversight that caused explicit namespace specifiers of subordinate export items to be ignored;
module M (T (type A))is now rejected (#12488).Added an
HsWrapperoptimiser, fixing a regression whereSPECIALIZEpragmas with higher-rank quantifiers were rejected with “RULE left-hand side too complicated to desugar” (#26349).Fixed a shadowing bug with implicit parameters (#26451).
Fixed a bug in the Cmm register-conflict analysis where an assignment’s left-hand side register was not accounted for, which could generate incorrect code (#26550).
Fixed a register allocator bug where the format of a spilled register was not updated after reassignment, which could corrupt vector register contents (#26542).
Fixed the order of spill/reload instructions emitted by the AArch64 native code generator (#26537).
Pass the
+evex512attribute to LLVM 18+ when-mavx512fis set (#26410).Properly handle errors during the link step in the driver (#26496).
User-written kinds of data declarations are now preserved instead of being expanded during kind checking. This affects the kinds stored in interface files and thus the documentation generated by Haddock.
Units with no exposed modules are now excluded from the
-Wunused-packagescheck (#24120).Fixed a bug in defaulting, which was doing some unification but then failing to iterate (#26582).
ghc -Mnow reports all missing modules at once, as opposed to only reporting a single missing module (#26551).Improved the performance of pattern-match overlap checking when there is a very large set of patterns (#26514).
Fixed PIC jump tables on Windows by avoiding overflows in jump tables (#24016).
Fixed an incorrect optimisation that folded multiplication, division, or remainder by an out-of-range power-of-2 literal into a shift (#25664).
Reinstated the Template Haskell level check when reporting out-of-scope identifiers, fixing misleading errors caused by staging errors (#26099).
Fixed a compiler panic when computing reachability to a module graph node that does not exist (#26568).
Reduced memory usage of the package database by using
OsPathinstead ofFilePathinPkgDbRefandUnitDatabase.Reduced allocations during recompilation checking by using
OsPathwhen checking file modification times.Fixed a number of register allocation bugs relating to register formats, some of which could corrupt vector register contents when spilling and reloading (#26411, #26526, #26668).
Enabled a Cmm comparison-folding optimisation on all architectures, previously restricted to x86/x86-64 (#26664).
Bumped the maximum supported LLVM version to 23 (#26813, #27764).
Fixed the inferred quantification order of function arrows with an explicit multiplicity,
a %m -> b, to be[a, m, b](#23764).Fixed data family instance type class instance changes not triggering recompilation (#26705).
Fixed associated type family changes not triggering recompilation in dependent modules (#26183).
Fixed a missing InVar->OutVar lookup in
SetLevels(#26681).Fixed LLVM backend
pdep/pexthandling for i386 targets (#26450).Account for “stupid theta” in the demand signature of data constructor wrappers (#26748).
Fixed scoping errors in the type-class specialiser (#26682, #27629).
Improved case merging by floating join points out of
DEFAULTalternatives (#26709).The driver now uses
-O3as the LLVM optimization level when compiling with-O2, trading compilation time for faster generated code.Improved newtype unwrapping in the constraint solver (#26746).
Add evals for strict data constructor arguments in worker functions (#26722).
Fixed PPC NCG shift right operations at smaller than word sizes (#26519).
Fixed split sections for the LLVM backend (#26770).
PPC NCG: generate the clear-right instruction at architecture width for all
MachOpwidths (#24145).Fixed two bugs in short-cut constraint solving, one of which stopped the
constraintspackage from compiling (#26805).Fixed a compiler loop caused by not taking the current simplifier phase into account when computing the phase range used to simplify the right-hand side of a RULE or stable unfolding (#26826).
Fixed a subtle bug in
GHC.Core.Utils.mkTickthat could generate type-incorrect code (#26772).Improved error messages for unsolved representational equalities (#15850, #20289, #20468, #23731, #25949, #26137).
Improved defaulting of representational equalities, which can now handle situations involving functional dependencies and type-family injectivity annotations.
Fixed non-determinism in
TyLitMapby using deterministic maps for strings (#26846).Under
ExplicitLevelImports, imported types are now subject to the same level (staging) checks as values (#26098).Fix the interaction of
ExplicitLevelImportswith qualified imports (#26616, #27385).PPC NCG: Use libcall for 64-bit
cmpxchgon 32-bit PowerPC (#23969).NCG for PPC: add pattern for
CmmRegOfftoiselExpr64(#26828).Fixed cast worker/wrapper incorrectly firing on INLINE functions (#26903).
Fixed a long-standing interaction between ticks and casts in
Eliminate Identity Case.Fixed non-determinism in
WithHsDocIdentifiersbinary instance by using a stable sort (#26858).Make the order of usages in interface files deterministic (#26877).
Fixed a bug where
mergeCaseAltscould move a tick in between a join point and its jump, producing invalid Core (#26642, #26693, #26929).Fixed negative type literals bypassing the renamer check via
RequiredTypeArguments, causing the compiler to hang (#26861).Fixed
-fcheck-prim-boundsfor non-constant arguments; previously bounds were only checked for constant (literal) arguments (#26958).Fixed linking against
libmon toolchains that enable--as-neededby default, by adding-lmafter the object files on the link line.Improved error messages for unsupported type literals, such as unboxed or fractional literals (#26862, #25121).
Vector literals on AArch64 without the LLVM backend now report “SIMD operations on AArch64 currently require the LLVM backend” instead of panicking.
NOINLINEpragmas are now applied to generatedTypeablebindings, reducing the number of exported top level names and unfoldings, which reduces interface file sizes and the number of global/dynamic linker symbols.Fixed the Haddock documentation for
GHC.Prim(#26954).Fixed non-determinism in the order of packages passed to the linker, which resulted in non-reproducible builds (#26838).
Fixed demand analysis giving an absent demand to an argument that was still used by the function’s stable unfolding, which could cause a run-time crash (#26416, #27626).
Constant-fold numeric literal casts when building unboxed sums during unarisation, so that top-level closures built from unboxed-sum literals are statically allocated instead of being allocated as thunks (#25650).
Fixed spurious incomplete record selector warnings for bare record field projections such as
.fld(#26686).Fixed
capiwrappers failing to compile with newer GCC/Clang by collapsing chains of void pointers to a singlevoid*(#26852).Unpacking of enumeration types now goes to
Word8#/Word16#/Word#directly instead of through an intermediate unboxed sum, allowing a branchless conversion (#26970).Fixed an infinite loop in the type checker triggered by deep subsumption (#26823).
AArch64: fixed a register allocation bug where
MOVK’s destination register was not marked as both read and written, which could clobber live values (#26980).Implemented basic value range analysis to determine at compile time the result of some comparison primops, and to filter unreachable alternatives in case expressions (#25718).
Word-to-float conversions on x86 now emit direct assembly instead of a C function call (#22252).
Fixed a segfault caused by refining the
DEFAULTalternative for dictionaries of unary typeclasses (#27071).Fix a bug where an absent constraint argument could be replaced by an error thunk, which GHC then evaluated, crashing the program (#27627).
Fix a bug where the specialiser could drop an argument that the function’s stable unfolding still used, resulting in a runtime crash (#27703).
Fix a bug where a class declared abstractly in an hs-boot file was assumed not to be unary, so GHC speculatively evaluated a dictionary that could be bottom, crashing the program (#27704).
Fix a bug where
-fspec-eval-dictfuncould speculatively evaluate a looping dictionary whose recursion went through an hs-boot import, hanging the program (#27717).Cache unit databases and use a global
UnitIndexto deduplicateUnitInfos across multiple home units, reducing memory usage (#26423, #27500, #27748).AArch64 code generation: use
SXTWinstead ofSXTHforW32sign extension (#26978).On AArch64, use a logical instead of an arithmetic right shift for the unsigned right shift (
MO_U_Shr) at 8/16 bit word size (#26979).Avoid AArch64 register clobbering bug in MUL2 (#27046).
Fix incorrect overflow bit for
MUL2on AArch64 for sub-W64operands (#27047).-finter-module-far-jumpsis now enabled by default for profiled ways on AArch64 Linux, working around jump offset overflow errors (“relocation truncated to fit: R_AARCH64_JUMP26”) from some binutils and gcc versions when linking large profiled libraries (#26994).A number of fixes to the ARM64 ncg, fixing a number of bugs, including incorrect runtime results when using subword operations (#27430, #27539, #27538, #27537, #27550, #27533).
Fixed
mkTickto avoid attaching profiling ticks to coercions, preventing a compiler panic (#27121).Fix two crashes that could happen in a multithreaded setting when profiling (#27123).
Fix “failed to detect OverLit” panic in the pattern-match checker (#25926, #27124).
Fix
getStgArgFromTrivialArgpanic in CoreToStg (#27182).Another fix for another
getStgArgFromTrivialArgpanic in CoreToStg (#27386).Don’t drop cost centres around variables of type
IO ()(#27225).Fix spurious
-Wincomplete-uni-patternswarning under-finfo-table-map(#27314).Recognise
considerAccessibleunder ticks (-g,-finfo-table-map,-fhpcetc) (#27360).Fix a panic on
@tyin a pattern synonym RHS (#27440).Fix spurious out-of-scope errors from
type tyin a pattern synonym RHS (#27583).Fix a panic on a required type argument in a pattern synonym RHS (#27586).
Stop representation-polymorphism checks from producing a coercion that fails Core Lint (#27639).
Fixed an issue that caused the specializer to sometimes loop on recursive dictionary superclasses (#27705).
Fix a CorePrep miscompilation that could project a field out of an absent dictionary, resulting in a segfault (#25924).
Fix exponential-time desugaring of nested
caseexpressions. The scrutinee is no longer desugared a second time when recording long-distance information for the pattern-match checker (#27383, #20251).Fix invalid cmm basic block output when proc-point splitting is enabled (wasm/llvm/unregisterised) (#27447).
Fix a token leak in the
-jsemjobserver shutdown path (#27253).Update to semaphore-compat 2.0.1 (
-jsemprotocol v2) (#25087).Introduce a cache of home module name providers (#27055).
Reference the correct package in error messages when trying to import a reexported module from a hidden package (#27417).
Eliminate redundant thunks introduced by tag inference (#27005).
Rename
ZonkAnytoUnusedTypeand add pretty printing logic for it (#27390).Fix module finalizers on multiple platforms (#27072).
Fix redundant AP thunk codegen when not using
-ticky-ap-thunk(#27502).When generating IPE stack frames, GHC now insists on using a source location that is local to the current module (#27749).
-fobject-determinismsorts the list of object files to be linked for reproducible builds (#27612).
2.1.3. GHCi¶
Added the
:versioncommand. This displays the current GHC version.Improved bytecode loading performance by caching
MallocStringsrequests for repeated breakpoint strings, avoiding redundant remote heap allocation (#26995).Added the
:shellcommand, which works similarly to:!, except it guarantees to run the command viash -c. On POSIX hosts the behavior is identical to:!, but on Windows it uses the msys2 shell instead of the systemcmd.exeshell.The GHCi startup banner now includes the active language edition, plus an indication of whether this was the default (#26037).
Added the
-fimport-loaded-targetsflag, which automatically imports all loaded targets into the GHCi session (#26866).Added support for custom external interpreter commands, allowing GHC API clients to extend the external interpreter with their own message handlers (#26652).
Removed the size limit on unboxed tuples supported by the bytecode interpreter on 64-bit platforms (#26946).
External interpreter trace messages are now printed to stderr instead of stdout (#26807).
Initialize plugins for
:set +cin GHCi (#23110).Fixed the order in which
:infolists instances, which previously depended on the order in which interface files happened to be loaded (#27532).Fix regression to allow loading modules into the GHCi after startup (#27202, #27640).
Allocate static constructors for bytecode, fixing segfaults when certain programs are loaded by the bytecode interpreter (#25636).
2.1.4. JavaScript backend¶
The JavaScript backend now exports the
HEAP8andHEAPU8symbols, which newer Emscripten versions require (#26290).The JavaScript backend now supports more than 128 registers, fixing runtime
ReferenceErrorfailures for functions taking very many arguments (#26558).Fixed JavaScript backend linking of units exposed in the unit database but not explicitly passed on the command line (#24886).
Fixed
Enumserialisation in the JavaScript backend, which went throughWord16(#24593).Fixed recompilation avoidance for the JavaScript backend (#23013).
Replaced the
BigInt-based implementations of 32-bit and 64-bitquot/remin the JavaScript backend with pureNumberarithmetic, avoiding the overhead ofBigIntpromotion (#23597).
2.1.5. WebAssembly backend¶
The internal-interpreter flag is now enabled for the
ghclibrary in wasm stage1, making it possible to launch a GHC API session that makes use of the internal interpreter (#26431, #25400).The wasm
dyldscript can now be used to load and run wasm shared libraries fully client-side in the browser without needing awasm32-wasi-ghcibackend.Fixed handling of
ByteArray#/MutableByteArray#arguments in JSFFI imports on the wasm backend.Use
import.meta.mainfor proper distinction of Node.js main modules (#26916).Added an
/assetsendpoint to the wasmdyldHTTP server and the-fghci-browser-assets-dirflag to specify the assets root directory, so assets can be fetched from the same host without a separate HTTP server (#26951).Fixed an
Illegal foreign declarationerror when wasm GHCi loads modules with JSFFI exports (#26998).Ensure post-linker output is synchronous ESM and fix loading in ServiceWorker (#27257).
2.1.6. Runtime system¶
Add a new
pollI/O manager, based on the classic unixpoll()API. It is the default I/O manager in the single-threaded RTS on all posix platforms except macOS (where theselectI/O manager remains the default due to macOS platform limitations). The I/O manager can be selected via the runtime flag--io-manager=(name).Compared to the
selectI/O manager, this one has slightly less severe restrictions on the number of sockets/pipes that can be waited on, though it still scales poorly for waiting on socket/pipe readiness. It does however scale much better for thread timers (such asthreadDelay), and improves timer precision on 32bit Linux and 32bit FreeBSD from milliseconds to microseconds.This I/O manager introduces new infrastructure for I/O managers that is intended to be used in future for a new generation of in-RTS I/O managers, using more scalable platform-specific APIs (such as epoll, io_uring and kqueue). This first one, based on
poll(), is merely intended to be portable.--eventlog-flush-interval=⟨seconds⟩is now disabled when compiled against the non-threaded RTS, where using it led to eventlog corruption (#26222).IPE entries now have a stable identifier instead of being indexed by their address, so profiles from different runs can be compared, and the IPE metadata is placed in a specific
.ipesection so it can be stripped from the final binary if desired (#21766).Added the
-hT ⟨type⟩and-hi ⟨addr⟩heap profile filtering options, which are available in non-profiled builds (#26361). Also fixed the brace syntax of-hfilter options, which had stopped working, and a bug where combining-he⟨era⟩and-hr⟨retainer⟩would ignore whether the retainer matches.Removed the signal-based ticker implementations. All platforms now use the pthreads and
nanosleepbased ticker (#27073).Removed the unnecessary
libm,libdlandneed-pthreadCabal flags from the RTS package, performing those checks via autoconf macros instead.Used computed goto for instruction dispatch in the bytecode interpreter, improving interpreter performance (#12953).
Fixed a deadlock with eventlog flush interval and RTS shutdown (#26573).
Handle 16-bit overflow of ELF section header string table (#26603).
Fixed object file format detection in
loadArchive(#26630).Fixed a number of instances of undefined behaviour in the bytecode interpreter, including a zero-length variable length array, an unaligned read, and signed integer overflow in subword arithmetic.
Fixed an ABI mismatch in calls to the variadic
barffunction, both in compiler-generated code and hand-written Cmm (#22882).shrinkMutableByteArray#now opportunistically reclaims slop space, reducing heap fragmentation, andresizeMutableByteArray#now grows theMutableByteArray#in-place if possible.Use
INFO_TABLE_CONSTRforstg_dummy_ret_closure(#26745).Switch prim to use modern atomic compiler builtins (#26729).
The runtime linker now supports COMMON symbols (#6107).
Fixed a potential crash when decoding stack snapshots, caused by an invalid pointer left in a GC-visible slot (#27009).
Fixed a missing profiling header in the
origin_thunkstack frame info table, which could cause corruption when the frame was copied by the garbage collector (#27007).Fixed the
SLIDEbytecode instruction crashing when sliding off the end of a stack chunk (#27001).Fixed a stack alignment bug on x86 that could cause segfaults or corrupted registers when using AVX/AVX-512 vector code (#26595, #26822).
Fixed a race condition where a cloned-stack request could be mishandled after its target thread migrated to another capability (#27008).
STM no longer creates a transaction for the right-hand side of
catchRetry#, avoiding quadratic behaviour for nestedorElse(#26028).Windows: fixed crashes and memory leaks in the legacy I/O manager’s handling of asynchronous I/O results (#26341).
Fixed a race condition between
flushEventLogandstartEventLogging/endEventLoggingthat could corrupt the eventlog (#27082).Fix a possible use-after-free bug with TSOs (#26716, #26717).
Add rts Message to set/unset TSO flags (#27131).
Fix several black hole handling bugs that could lead to deadlocks or crashes in multithreaded programs. These could show up as the program hanging or “END_TSO_QUEUE object entered” errors (#26922, #26936).
Fix “unknown/strange object 24 crash” in compacting GC (#27434).
Fix a parallel GC race on weakly-ordered architectures (AArch64) that could crash or silently corrupt the heap (#27477).
Fix “unknown/strange object 1” crash in the compacting GC when collecting large data constructor closures (#27649).
Fix a crash when capturing or resuming a delimited continuation that adjusts the async exception masking state (#27651).
Fix a segfault that could occur when querying the label of an unlabeled thread (#27618).
Rethrow exceptions in overlapped IO when using the WinIO IO manager (#27283).
The RTS API now exposes the
RUNTIME_TRACE_FLAGtype and thegetTraceFlagandsetTraceFlagfunctions that can be used to change the trace flags at runtime (#27186).The RTS
-lflag now accepts the new event classI, which controls whether or not IPE events are emitted (#27239).
2.1.7. Cmm¶
2.1.8. base library¶
GHC.Num.{BigNat, Integer, Natural}are no longer exposed. Users should import them fromghc-bignuminstead (CLC proposal #359).GHC internals in
GHC.Numhave been deprecated and will be removed after one major release (CLC proposal #360).Removed
GHC.Desugar, which was deprecated and should have been removed in GHC 9.14.Removed
GHC.JS.Prim.Internal.Build(CLC proposal #329).Modified the implementation of
Data.List.sortOnto use(>)instead ofcompare(CLC proposal #332).Removed extra laziness from
Data.Bifunctor.Bifunctorinstances for all tuples to have the same laziness as theirData.Functor.Functorcounterparts, i.e. they became more strict than before (CLC proposal #339).Adjusted the strictness of
Data.List.iterate'to be more reasonable: every element of the output list is forced to WHNF when the(:)containing it is forced (CLC proposal #335).Changed
hIsReadableandhIsWritablesuch that they always throw a respective exception when encountering a closed or semi-closed handle, not just in the case of a file handle (CLC proposal #371).Added
{-# WARNING in "x-partial" #-}toData.List.{init,last}. Use{-# OPTIONS_GHC -Wno-x-partial #-}to disable it (CLC proposal #292).Added
Data.List.NonEmpty.mapMaybe(CLC proposal #337).Added
thenAandthenM(CLC proposal #351).Added
nubOrdandnubOrdBytoData.ListandData.List.NonEmpty(CLC proposal #336).Added
SemigroupandMonoidinstances forControl.Monad.ST.Lazy(CLC proposal #374).Generalized
deleteByanddeleteFirstsBy(CLC proposal #372).Added
System.IO.hGetNewlineMode(CLC proposal #370).Added a new module
System.IO.OSwith operations for obtaining operating-system handles (file descriptors, Windows handles) (CLC proposal #369).Exported
labelThreadfromControl.Concurrent(CLC proposal #376).Fixed issues with
toRationalfor types capable to represent infinite and not-a-number values (CLC proposal #338).Ensured that
rationalToFloatandrationalToDoublealways inline in the end (CLC proposal #356).Improved the error message for
Data.Char.chr(CLC proposal #384).GHC.Conc.throwSTMandGHC.Conc.Sync.throwSTMnow carry aHasCallStackconstraint and attach aBacktraceannotation to the thrown exception (#25365).GHC.Conc.catchSTMandGHC.Conc.Sync.catchSTMnow attach aWhileHandlingannotation to exceptions thrown from the handler (#25365).Backtraces for
errorexceptions are now evaluated at the moment they are thrown (CLC proposal #383, #26751).Implementation details are now hidden when throwing exceptions in
throwandthrowSTM(CLC proposal #387).The
onExceptioncontinuation is now annotated withWhileHandling(CLC proposal #397, #26759).Added
@sinceannotation toSystem.Info.fullCompilerVersion(#26973).Don’t drop
ExceptionContextinSomeException(toException)(#27455).Fix
retryand async exception delivery inside acatchSTMhandler (#27657).Show
ExceptionContextin thedisplayExceptionAnnotationimplementation ofWhileHandling(#27456).
2.1.9. ghc-prim library¶
2.1.10. ghc library¶
Fixed the
Datainstance forModuleNameto give a non-bottomtoConstrimplementation (#27129).SourceErrornow stores the context needed to print its diagnostics, via the newSourceErrorContextdatatype (#26387).HsTyLithas been dropped in favor ofHsLit, with newHsNaturalandHsDoubleconstructors (#26862, #25121).thNameToGhcNamehas been generalised via the newHasHscEnvclass, modelled onHasDynFlags. It is the recommended way of looking up names in GHC plugins.Added an
Outputableinstance forNatural, as well as anatural :: Natural -> SDocfunction that mirrors the existingintegerfunction.Renamed
interpreterBackendtobytecodeBackend. TheinterpreterBackendbinding is left as a deprecated alias.Removed the
Datainstance forClsInst.Merged
HsMultilineStringintoHsString, soHsLitno longer has a separate constructor for multi-line string literals (#26860).TopLevelFlagandRuleNamemoved toLanguage.Haskell.Syntax.Basic,OverlapModeto the new moduleLanguage.Haskell.Syntax.OverlapandOverlapFlagto the new moduleGHC.Hs.Decls.Overlap.OverlapModegained a TTG extension point.Added missing
(==)logic for theHsInt{8,16,32}andHsWord{8,16,32}constructors ofHsLit.ForeignCalltypes that do not need extension points moved to the newLanguage.Haskell.Syntax.Decls.Foreignmodule.CCallTarget,CTypeandHeadergained TTG extension points, and theirBoolparameters were replaced with descriptive data types.Removed the backwards compatibility pattern synonym
ModLocation(#24932).Fixed several oversights in
GHC.Hs.Syn.Type.hsExprType(#26910).Drop
preloadClosurefromUnitState(#27308).Fix the
Data.Datainstance ofHsCtxtto avoid a crash (#27359).The records for typechecker plugins and defaulting plugins have been updated to reflect the fact that these plugins may be invoked after the end of typechecking. The fields
tcPluginStopanddePluginStopare replaced bytcPluginPostTc/tcPluginShutdownanddePluginPostTc/dePluginShutdownrespectively. To migrate a plugin whose stop action was a simple resource release, move that action totcPluginShutdownand settcPluginPostTc = const (return ())(#26839).typecheckModule,hscTypecheckRename,hscTypecheckRenameWithDiagnosticsandhscTypecheckAndGetWarningsall take an additional argument that specifies how to start/stopTcMplugins, andtcRnModulenow takes aTcRnModuleOptionsrecord (#26839).Removed
withTcPlugins,withHoleFitPluginsandwithDefaultingPluginsin favour of a singlewithTcMPlugins(#26839).
2.1.11. ghc-heap library¶
Fix invalid srtlen field returned by peekItbl when no tables-next-to-code (#27465).
2.1.12. ghc-internal library¶
Fixed a crash when decoding a captured stack containing a bytecode object with an empty payload bitmap (#26640).
2.1.13. ghc-experimental library¶
New SIMD primops for bitwise logical operations on 128-wide vectors, and new
abs/sqrtSIMD primops for absolute value and square root, such asabsInt32X4#andsqrtDoubleX4#. These are supported by the LLVM backend and the X86_64 NCG backend (for the latter, only for 128-wide vectors).Fixed the
GHC.Exception.Backtrace.Experimentalmodule, which was not compiled or included in the library.Added an optional
SrcLocto theStackAnnotationclass inGHC.Stack.Annotation.Experimental(#26806).Added a cumulative
gc_sync_elapsed_nscounter toRTSStats(#26944).Exposed
decodeStackWithIpeand related stack-decoding helpers fromghc-experimental(#27065).
2.1.14. template-haskell library¶
Introduced
namedDefaultQuasiQuoteranddefaultQuasiQuoter, which fail with a helpful error when used in an inappropriate context (#24434).We have added the
addDependentDirectoryfunction to matchaddDependentFile, which adds a directory to the list of dependencies that the recompilation checker will look at to determine if a module needs to be recompiled.
2.1.15. Packaging and Build System¶
The minimal bootstrap GHC version has been bumped to 9.10.
configureno longer probes for thegoldlinker, which has been dropped from binutils 2.44 (#25716).configurenow checks thatpython3is at least version 3.7, as the testsuite driver requires (#23234), and a missing python is now a warning instead of an error, so it is not mandatory when installing a bindist (#26347).Hadrian now enables
terminfoif--with-curses-*flags are given toconfigure, and cross-builds buildterminfoonly in upper stages, which re-enables building cross-compilers withterminfo(#26288).GHC now reads
lib/targets/default.target, a serializedghc-toolchainTarget, and the now-redundant entries have been removed fromlib/settings(#24212).CFLAGS,CXXFLAGSand similar flags given toconfigureapply to building GHC itself and are no longer carried over to the target settings used by GHC at runtime (#25637).The bindist
configurescript now checksccconsistently with the sourceconfigurescript (#26394), and the build, host and target platforms chosen at the initialconfigureare correctly propagated to it (#21970).Hadrian builds the in-tree gmp with
-fvisibility=hidden, so gmp symbols are no longer exported by theghc-internalshared library.ghc-toolchainnow detects the PowerPC 64-bit ABI (#26521).Fixed an
-Wincompatible-pointer-typeserror in theutimbufFFI wrapper on Windows with recent toolchains (#26337).Hadrian now places user-supplied arguments after package arguments, making it easier to override default package arguments in
UserSettings.hs(#25821).Added the
with_profiled_libsHadrian flavour transformer, the exact opposite ofno_profiled_libs, and fixed theprofiled_ghcflavour transformer to include profiled dynamic libraries.Hadrian now only installs the JavaScript files required by the wasm and JS targets into
libdirfor those targets, instead of unconditionally on other targets as well.Removed the
--via-asmhsc2hs flag when cross compiling to Windows, which fails with recent llvm-mingw toolchains.libffiis now built and bundled via the newlibffi-clibsubmodule and Haskell package instead of bespoke Hadrian logic. The ability to link against a systemlibffiis retained.Removed a build-system hack that forced
-fno-PICon RTS objects on i386, restoring compatibility with modern toolchains (#26792).ghc-toolchainnow also configureswindreson non-Windows platforms, as it may be needed for cross compilation (#24588).ghc-toolchainandconfigurenow check for a C11-capable C compiler instead of C99 (#26908).The build system now accepts version 2.2 of the
happyparser generator.Deprecated Hadrian’s
--bignumflag in favour of the+native_bignumflavour transformer, which is now enabled automatically for the JS target.Hadrian now builds profiled dynamic objects with
-dynamic-too, improving build parallelism (#27010).Installed the
rts/Types.hheader when using the JavaScript backend, fixing use ofHsFFI.h(#27033).Fixed the
--targetsupport check inconfigureto use the stage0 C compiler instead of$CC(#26999).configurenow defaults$LLVMASto$CCwhen$CcLlvmBackendisYES, instead of an auto-detectedclangfrom the environment (#26769).Fixed building the RTS with
-Werroron glibc 2.43, which changed the values of_XOPEN_SOURCEand_POSIX_C_SOURCE(#27076).Debian 9 and 10 and Ubuntu 18.04 and 20.04 are end of life and have been dropped from CI and the release bindists. Debian 13 has been added (#25876).
Fixed the build of
getExecutablePathon GNU/Hurd, and GNU/Hurd is now advertised asgnu, like the autotools do.Bumped the
processsubmodule to 1.6.30.0, which includes a fix for a segfault on macOS 15 with certain command line SDK versions (#27144).Hadrian no longer leaves stale
.conffiles in its package databases when rebuilding in the same build root with different settings (e.g. another flavour, or when hashes change with+hash-unit-ids) (#26661).
2.1.16. ghc-pkg¶
Removed
traceIdfrom theghc-pkgexecutable.Improve performance of
ghc-pkg listcommand (#27275).
2.1.17. Included libraries¶
The package database provided with this distribution also contains a number of packages other than GHC itself. See the changelogs provided with these packages for further change information.
| Package | Version | Reason for inclusion |
|---|---|---|
ghc |
10.0.0.20260917 | The compiler itself |
Cabal-syntax |
3.18.1.0 | Dependency of |
Cabal |
3.18.1.0 | Dependency of |
Win32 |
2.14.2.2 | Dependency of |
array |
0.5.8.0 | Dependency of |
base |
4.23.0.0 | Core library |
binary |
0.8.9.3 | Dependency of |
bytestring |
0.12.2.0 | Dependency of |
containers |
0.8 | Dependency of |
deepseq |
1.5.2.0 | Dependency of |
directory |
1.3.11.0 | Dependency of |
exceptions |
0.10.12 | Dependency of |
file-io |
0.2.0 | Dependency of |
filepath |
1.5.5.0 | Dependency of |
ghc-boot-th |
10.0.0.20260917 | Internal compiler library |
ghc-boot |
10.0.0.20260917 | Internal compiler library |
ghc-compact |
0.1.0.0 | Core library |
ghc-heap |
10.0.0.20260917 | GHC heap-walking library |
ghc-prim |
0.14.0 | Core library |
ghci |
10.0.0.20260917 | The REPL interface |
haskeline |
0.8.5.0 | Dependency of |
hpc |
0.7.0.2 | Dependency of |
integer-gmp |
1.1 | Core library |
mtl |
2.3.2 | Dependency of |
os-string |
2.0.11 | Dependency of |
parsec |
3.1.18.0 | Dependency of |
pretty |
1.1.3.6 | Dependency of |
process |
1.6.30.0 | Dependency of |
stm |
2.5.3.1 | Dependency of |
template-haskell |
2.25.0.0 | Core library |
terminfo |
0.4.1.7 | Dependency of |
text |
2.1.4 | Dependency of |
time |
1.16.0.1 | Dependency of |
transformers |
0.6.3.0 | Dependency of |
unix |
2.8.8.0 | Dependency of |
xhtml |
3000.4.1.0 | Dependency of |
haddock-api |
2.34.0 | Dependency of |
haddock-library |
1.11.0 | Dependency of |