Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
-
c5d06f56
by Cheng Shao at 2026-01-18T00:19:19-05:00
-
2a2450af
by Simon Peyton Jones at 2026-01-18T00:19:19-05:00
-
50a96a82
by Cheng Shao at 2026-01-18T00:19:20-05:00
-
29b8a74d
by Cheng Shao at 2026-01-18T00:19:21-05:00
27 changed files:
- .gitmodules
- compiler/GHC/Builtin/Names.hs
- docs/users_guide/9.16.1-notes.rst
- hadrian/doc/flavours.md
- hadrian/src/Settings/Default.hs
- hadrian/src/Settings/Flavours/Benchmark.hs
- hadrian/src/Settings/Flavours/Development.hs
- hadrian/src/Settings/Flavours/GhcInGhci.hs
- hadrian/src/Settings/Flavours/Performance.hs
- hadrian/src/Settings/Flavours/Quick.hs
- hadrian/src/Settings/Flavours/QuickCross.hs
- hadrian/src/Settings/Flavours/Quickest.hs
- hadrian/src/Settings/Flavours/Validate.hs
- libraries/ghc-internal/ghc-internal.cabal.in
- libraries/ghc-internal/src/GHC/Internal/Classes.hs
- + libraries/ghc-internal/src/GHC/Internal/Classes/IP.hs
- − rts/win32/libHSffi.def
- − rts/win32/libHSghc-internal.def
- − rts/win32/libHSghc-prim.def
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/base-exports.stdout-mingw32
- testsuite/tests/interface-stability/base-exports.stdout-ws-32
- testsuite/tests/interface-stability/ghc-prim-exports.stdout
- testsuite/tests/interface-stability/ghc-prim-exports.stdout-mingw32
- testsuite/tests/th/TH_implicitParams.stdout
- + testsuite/tests/typecheck/should_compile/T26737.hs
- testsuite/tests/typecheck/should_compile/all.T
Changes:
| ... | ... | @@ -122,4 +122,4 @@ |
| 122 | 122 | url = https://gitlab.haskell.org/ghc/template-haskell-quasiquoter.git
|
| 123 | 123 | [submodule "libraries/libffi-clib"]
|
| 124 | 124 | path = libraries/libffi-clib
|
| 125 | - url = https://github.com/stable-haskell/libffi-clib.git |
|
| 125 | + url = https://gitlab.haskell.org/ghc/libffi-clib.git |
| ... | ... | @@ -526,7 +526,7 @@ genericTyConNames = [ |
| 526 | 526 | |
| 527 | 527 | gHC_PRIM, gHC_PRIM_PANIC,
|
| 528 | 528 | gHC_TYPES, gHC_INTERNAL_DATA_DATA, gHC_MAGIC, gHC_MAGIC_DICT,
|
| 529 | - gHC_CLASSES, gHC_PRIMOPWRAPPERS :: Module
|
|
| 529 | + gHC_CLASSES, gHC_CLASSES_IP, gHC_PRIMOPWRAPPERS :: Module
|
|
| 530 | 530 | gHC_PRIM = mkGhcInternalModule (fsLit "GHC.Internal.Prim") -- Primitive types and values
|
| 531 | 531 | gHC_PRIM_PANIC = mkGhcInternalModule (fsLit "GHC.Internal.Prim.Panic")
|
| 532 | 532 | gHC_TYPES = mkGhcInternalModule (fsLit "GHC.Internal.Types")
|
| ... | ... | @@ -534,6 +534,7 @@ gHC_MAGIC = mkGhcInternalModule (fsLit "GHC.Internal.Magic") |
| 534 | 534 | gHC_MAGIC_DICT = mkGhcInternalModule (fsLit "GHC.Internal.Magic.Dict")
|
| 535 | 535 | gHC_CSTRING = mkGhcInternalModule (fsLit "GHC.Internal.CString")
|
| 536 | 536 | gHC_CLASSES = mkGhcInternalModule (fsLit "GHC.Internal.Classes")
|
| 537 | +gHC_CLASSES_IP = mkGhcInternalModule (fsLit "GHC.Internal.Classes.IP")
|
|
| 537 | 538 | gHC_PRIMOPWRAPPERS = mkGhcInternalModule (fsLit "GHC.Internal.PrimopWrappers")
|
| 538 | 539 | gHC_INTERNAL_TUPLE = mkGhcInternalModule (fsLit "GHC.Internal.Tuple")
|
| 539 | 540 | |
| ... | ... | @@ -1521,7 +1522,7 @@ fromLabelClassOpName |
| 1521 | 1522 | -- Implicit Parameters
|
| 1522 | 1523 | ipClassName :: Name
|
| 1523 | 1524 | ipClassName
|
| 1524 | - = clsQual gHC_CLASSES (fsLit "IP") ipClassKey
|
|
| 1525 | + = clsQual gHC_CLASSES_IP (fsLit "IP") ipClassKey
|
|
| 1525 | 1526 | |
| 1526 | 1527 | -- Overloaded record fields
|
| 1527 | 1528 | hasFieldClassName :: Name
|
| ... | ... | @@ -30,6 +30,18 @@ Language |
| 30 | 30 | - The extension :extension:`ExplicitNamespaces` now allows namespace-specified
|
| 31 | 31 | wildcards ``type ..`` and ``data ..`` in import and export lists.
|
| 32 | 32 | |
| 33 | +- Implicit parameters and ``ImpredicativeTypes``. GHC now knows
|
|
| 34 | + that if ``?foo::S`` is coecible to ``?foo::T`` only if ``S`` is coercible to ``T``.
|
|
| 35 | + Example (from :ghc-ticket:`#26737`)::
|
|
| 36 | + |
|
| 37 | + {-# LANGUAGE ImplicitParams, ImpredicativeTypes #-}
|
|
| 38 | + newtype N = MkN Int
|
|
| 39 | + test :: ((?foo::N) => Bool) -> ((?foo::Int) => Bool)
|
|
| 40 | + test = coerce
|
|
| 41 | + |
|
| 42 | + This is achieved by arranging that ``?foo :: T`` has a representational
|
|
| 43 | + role for ``T``.
|
|
| 44 | + |
|
| 33 | 45 | Compiler
|
| 34 | 46 | ~~~~~~~~
|
| 35 | 47 |
| ... | ... | @@ -37,8 +37,8 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH |
| 37 | 37 | <tr>
|
| 38 | 38 | <th>default<br></td>
|
| 39 | 39 | <td> </td>
|
| 40 | - <td>-O<br>-H32m<br></td>
|
|
| 41 | - <td>-O2<br>-H32m</td>
|
|
| 40 | + <td>-O<br>+RTS<br>-O64M<br>-RTS<br></td>
|
|
| 41 | + <td>-O2<br>+RTS<br>-O64M<br>-RTS</td>
|
|
| 42 | 42 | <td></td>
|
| 43 | 43 | <td>-haddock</td>
|
| 44 | 44 | <td></td>
|
| ... | ... | @@ -49,8 +49,8 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH |
| 49 | 49 | <tr>
|
| 50 | 50 | <th>quick</td>
|
| 51 | 51 | <td> </td>
|
| 52 | - <td>-O0<br>-H64m</td>
|
|
| 53 | - <td>-O0<br>-H64m</td>
|
|
| 52 | + <td>-O0<br>+RTS<br>-O64M<br>-RTS</td>
|
|
| 53 | + <td>-O0<br>+RTS<br>-O64M<br>-RTS</td>
|
|
| 54 | 54 | <td></td>
|
| 55 | 55 | <td>-O</td>
|
| 56 | 56 | <td>-O2</td>
|
| ... | ... | @@ -61,8 +61,8 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH |
| 61 | 61 | <tr>
|
| 62 | 62 | <th>quick-validate</td>
|
| 63 | 63 | <td></td>
|
| 64 | - <td>-O0<br>-H64m<br>-Werror</td>
|
|
| 65 | - <td>-O0<br>-H64m<br>-Werror</td>
|
|
| 64 | + <td>-O0<br>+RTS<br>-O64M<br>-RTS<br>-Werror</td>
|
|
| 65 | + <td>-O0<br>+RTS<br>-O64M<br>-RTS<br>-Werror</td>
|
|
| 66 | 66 | <td></td>
|
| 67 | 67 | <td>-O</td>
|
| 68 | 68 | <td>-O2</td>
|
| ... | ... | @@ -73,8 +73,8 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH |
| 73 | 73 | <tr>
|
| 74 | 74 | <th>quick-debug</td>
|
| 75 | 75 | <td></td>
|
| 76 | - <td>-O0<br>-H64m</td>
|
|
| 77 | - <td>-O0<br>-H64m</td>
|
|
| 76 | + <td>-O0<br>+RTS<br>-O64M<br>-RTS</td>
|
|
| 77 | + <td>-O0<br>+RTS<br>-O64M<br>-RTS</td>
|
|
| 78 | 78 | <td></td>
|
| 79 | 79 | <td>-O</td>
|
| 80 | 80 | <td>-O2</td>
|
| ... | ... | @@ -85,8 +85,8 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH |
| 85 | 85 | <tr>
|
| 86 | 86 | <th>quickest</td>
|
| 87 | 87 | <td></td>
|
| 88 | - <td>-O0<br>-H64m</td>
|
|
| 89 | - <td>-O0<br>-H64m</td>
|
|
| 88 | + <td>-O0<br>+RTS<br>-O64M<br>-RTS</td>
|
|
| 89 | + <td>-O0<br>+RTS<br>-O64M<br>-RTS</td>
|
|
| 90 | 90 | <td></td>
|
| 91 | 91 | <td></td>
|
| 92 | 92 | <td>-O</td>
|
| ... | ... | @@ -97,8 +97,8 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH |
| 97 | 97 | <tr>
|
| 98 | 98 | <th>perf</td>
|
| 99 | 99 | <td> Yes (on supported platforms) </td>
|
| 100 | - <td>-O<br>-H64m</td>
|
|
| 101 | - <td>-O<br>-H64m</td>
|
|
| 100 | + <td>-O<br>+RTS<br>-O64M<br>-RTS</td>
|
|
| 101 | + <td>-O<br>+RTS<br>-O64M<br>-RTS</td>
|
|
| 102 | 102 | <td></td>
|
| 103 | 103 | <td>-O2</td>
|
| 104 | 104 | <td>-O2</td>
|
| ... | ... | @@ -109,8 +109,8 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH |
| 109 | 109 | <tr>
|
| 110 | 110 | <th>release (same as perf with -haddock and +no_self_recomp+hash_unit_ids)</td>
|
| 111 | 111 | <td></td>
|
| 112 | - <td>-O<br>-H64m</td>
|
|
| 113 | - <td>-O<br>-H64m</td>
|
|
| 112 | + <td>-O<br>+RTS<br>-O64M<br>-RTS</td>
|
|
| 113 | + <td>-O<br>+RTS<br>-O64M<br>-RTS</td>
|
|
| 114 | 114 | <td></td>
|
| 115 | 115 | <td>-O2</td>
|
| 116 | 116 | <td>-O2</td>
|
| ... | ... | @@ -121,8 +121,8 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH |
| 121 | 121 | <tr>
|
| 122 | 122 | <th>bench</td>
|
| 123 | 123 | <td></td>
|
| 124 | - <td>-O<br>-H64m</td>
|
|
| 125 | - <td>-O<br>-H64m</td>
|
|
| 124 | + <td>-O<br>+RTS<br>-O64M<br>-RTS</td>
|
|
| 125 | + <td>-O<br>+RTS<br>-O64M<br>-RTS</td>
|
|
| 126 | 126 | <td></td>
|
| 127 | 127 | <td>-O2</td>
|
| 128 | 128 | <td>-O2</td>
|
| ... | ... | @@ -133,8 +133,8 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH |
| 133 | 133 | <tr>
|
| 134 | 134 | <th>devel1</td>
|
| 135 | 135 | <td></td>
|
| 136 | - <td>-O<br>-H64m</td>
|
|
| 137 | - <td>-O<br>-H64m</td>
|
|
| 136 | + <td>-O<br>+RTS<br>-O64M<br>-RTS</td>
|
|
| 137 | + <td>-O<br>+RTS<br>-O64M<br>-RTS</td>
|
|
| 138 | 138 | <td></td>
|
| 139 | 139 | <td>-dcore-lint</td>
|
| 140 | 140 | <td>-O0<br>-DDEBUG</td>
|
| ... | ... | @@ -145,8 +145,8 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH |
| 145 | 145 | <tr>
|
| 146 | 146 | <th>devel2</td>
|
| 147 | 147 | <td></td>
|
| 148 | - <td>-O<br>-H64m</td>
|
|
| 149 | - <td>-O<br>-H64m</td>
|
|
| 148 | + <td>-O<br>+RTS<br>-O64M<br>-RTS</td>
|
|
| 149 | + <td>-O<br>+RTS<br>-O64M<br>-RTS</td>
|
|
| 150 | 150 | <td></td>
|
| 151 | 151 | <td>-dcore-lint</td>
|
| 152 | 152 | <td>-O2</td>
|
| ... | ... | @@ -157,7 +157,7 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH |
| 157 | 157 | <tr>
|
| 158 | 158 | <th>validate</td>
|
| 159 | 159 | <td></td>
|
| 160 | - <td>-O0<br>-H64m</td>
|
|
| 160 | + <td>-O0<br>+RTS<br>-O64M<br>-RTS</td>
|
|
| 161 | 161 | <td>-fllvm-fill-undef-with-garbage<br>-fcheck-prim-bounds</td>
|
| 162 | 162 | <td></td>
|
| 163 | 163 | <td>-O<br>-dcore-lint<br>-dno-debug-output</td>
|
| ... | ... | @@ -169,7 +169,7 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH |
| 169 | 169 | <tr>
|
| 170 | 170 | <th>slow-validate</td>
|
| 171 | 171 | <td></td>
|
| 172 | - <td>-O0<br>-H64m</td>
|
|
| 172 | + <td>-O0<br>+RTS<br>-O64M<br>-RTS</td>
|
|
| 173 | 173 | <td>-fllvm-fill-undef-with-garbage</td>
|
| 174 | 174 | <td></td>
|
| 175 | 175 | <td>-O<br>-dcore-lint<br>-dno-debug-output</td>
|
| ... | ... | @@ -181,8 +181,8 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH |
| 181 | 181 | <tr>
|
| 182 | 182 | <th>static</td>
|
| 183 | 183 | <td></td>
|
| 184 | - <td>-O<br>-H64m<br>-fPIC -static</td>
|
|
| 185 | - <td>-O<br>-H64m<br>-fPIC -static</td>
|
|
| 184 | + <td>-O<br>+RTS<br>-O64M<br>-RTS<br>-fPIC -static</td>
|
|
| 185 | + <td>-O<br>+RTS<br>-O64M<br>-RTS<br>-fPIC -static</td>
|
|
| 186 | 186 | <td></td>
|
| 187 | 187 | <td>-O2</td>
|
| 188 | 188 | <td>-O2</td>
|
| ... | ... | @@ -274,7 +274,7 @@ defaultSourceArgs :: SourceArgs |
| 274 | 274 | defaultSourceArgs = SourceArgs
|
| 275 | 275 | { hsDefault = mconcat [ stage0 ? arg "-O"
|
| 276 | 276 | , notStage0 ? arg "-O2"
|
| 277 | - , arg "-H32m" ]
|
|
| 277 | + , pure ["+RTS", "-O64M", "-RTS"] ]
|
|
| 278 | 278 | , hsLibrary = notStage0 ? arg "-haddock"
|
| 279 | 279 | , hsCompiler = mempty
|
| 280 | 280 | , hsGhc = mempty }
|
| ... | ... | @@ -16,7 +16,7 @@ benchmarkFlavour = defaultFlavour |
| 16 | 16 | |
| 17 | 17 | benchmarkArgs :: Args
|
| 18 | 18 | benchmarkArgs = sourceArgs SourceArgs
|
| 19 | - { hsDefault = pure ["-O", "-H64m"]
|
|
| 19 | + { hsDefault = pure ["-O", "+RTS", "-O64M", "-RTS"]
|
|
| 20 | 20 | , hsLibrary = pure ["-O2"]
|
| 21 | 21 | -- TODO: We should really pass -O2 when notStage0. Otherwise, we aren't
|
| 22 | 22 | -- really measuring the overhead of a potential new optimisation we want
|
| ... | ... | @@ -26,7 +26,7 @@ developmentFlavour ghcStage = defaultFlavour |
| 26 | 26 | developmentArgs :: Stage -> Args
|
| 27 | 27 | developmentArgs ghcStage =
|
| 28 | 28 | sourceArgs SourceArgs
|
| 29 | - { hsDefault = mconcat [ pure ["-O", "-H64m"],
|
|
| 29 | + { hsDefault = mconcat [ pure ["-O", "+RTS", "-O64M", "-RTS"],
|
|
| 30 | 30 | -- Disable optimization when building Cabal;
|
| 31 | 31 | -- this saves many minutes of build time.
|
| 32 | 32 | package cabal ? pure ["-O0"]]
|
| ... | ... | @@ -22,7 +22,7 @@ ghcInGhciFlavour = defaultFlavour |
| 22 | 22 | ghciArgs :: Args
|
| 23 | 23 | ghciArgs = sourceArgs SourceArgs
|
| 24 | 24 | { hsDefault = mconcat $
|
| 25 | - [ pure ["-O0", "-H64m"]
|
|
| 25 | + [ pure ["-O0", "+RTS", "-O64M", "-RTS"]
|
|
| 26 | 26 | ]
|
| 27 | 27 | , hsLibrary = mempty
|
| 28 | 28 | , hsCompiler = mempty
|
| ... | ... | @@ -12,7 +12,7 @@ performanceFlavour = splitSections $ enableLateCCS $ defaultFlavour |
| 12 | 12 | |
| 13 | 13 | performanceArgs :: Args
|
| 14 | 14 | performanceArgs = sourceArgs SourceArgs
|
| 15 | - { hsDefault = pure ["-O", "-H64m"]
|
|
| 15 | + { hsDefault = pure ["-O", "+RTS", "-O64M", "-RTS"]
|
|
| 16 | 16 | , hsLibrary = orM [notStage0, cross] ? arg "-O2"
|
| 17 | 17 | , hsCompiler = pure ["-O2"]
|
| 18 | 18 | , hsGhc = mconcat
|
| ... | ... | @@ -34,7 +34,7 @@ quickFlavour = defaultFlavour |
| 34 | 34 | |
| 35 | 35 | quickArgs :: Args
|
| 36 | 36 | quickArgs = sourceArgs SourceArgs
|
| 37 | - { hsDefault = mconcat [ pure ["-O0", "-H64m"] ]
|
|
| 37 | + { hsDefault = mconcat [ pure ["-O0", "+RTS", "-O64M", "-RTS"] ]
|
|
| 38 | 38 | , hsLibrary = notStage0 ? arg "-O"
|
| 39 | 39 | , hsCompiler = stage0 ? arg "-O2"
|
| 40 | 40 | , hsGhc = stage0 ? arg "-O" }
|
| ... | ... | @@ -32,7 +32,7 @@ quickCrossFlavour = defaultFlavour |
| 32 | 32 | quickCrossArgs :: Args
|
| 33 | 33 | quickCrossArgs = sourceArgs SourceArgs
|
| 34 | 34 | { hsDefault = mconcat $
|
| 35 | - [ pure ["-O0", "-H64m"]
|
|
| 35 | + [ pure ["-O0", "+RTS", "-O64M", "-RTS"]
|
|
| 36 | 36 | ]
|
| 37 | 37 | , hsLibrary = notStage0 ? mconcat [ arg "-O", arg "-fllvm" ]
|
| 38 | 38 | , hsCompiler = stage0 ? arg "-O2"
|
| ... | ... | @@ -19,7 +19,7 @@ quickestFlavour = defaultFlavour |
| 19 | 19 | quickestArgs :: Args
|
| 20 | 20 | quickestArgs = sourceArgs SourceArgs
|
| 21 | 21 | { hsDefault = mconcat $
|
| 22 | - [ pure ["-O0", "-H64m"]
|
|
| 22 | + [ pure ["-O0", "+RTS", "-O64M", "-RTS"]
|
|
| 23 | 23 | ]
|
| 24 | 24 | , hsLibrary = mempty
|
| 25 | 25 | , hsCompiler = stage0 ? arg "-O"
|
| ... | ... | @@ -16,11 +16,12 @@ validateFlavour = enableLinting $ quickValidateFlavour |
| 16 | 16 | |
| 17 | 17 | validateArgs :: Args
|
| 18 | 18 | validateArgs = sourceArgs SourceArgs
|
| 19 | - { hsDefault = mconcat [ stage0 ? pure ["-O0", "-H64m"]
|
|
| 19 | + { hsDefault = mconcat [ stage0 ? pure ["-O0"]
|
|
| 20 | 20 | -- See #11487
|
| 21 | 21 | , notStage0 ? arg "-fllvm-fill-undef-with-garbage"
|
| 22 | 22 | , notStage0 ? arg "-dno-debug-output"
|
| 23 | 23 | , notStage0 ? arg "-fcheck-prim-bounds"
|
| 24 | + , pure ["+RTS", "-O64M", "-RTS"]
|
|
| 24 | 25 | ]
|
| 25 | 26 | , hsLibrary = pure ["-O"]
|
| 26 | 27 | , hsCompiler = mconcat [ stage0 ? pure ["-O2"]
|
| ... | ... | @@ -37,7 +38,7 @@ slowValidateFlavour = validateFlavour |
| 37 | 38 | |
| 38 | 39 | quickValidateArgs :: Args
|
| 39 | 40 | quickValidateArgs = sourceArgs SourceArgs
|
| 40 | - { hsDefault = mempty
|
|
| 41 | + { hsDefault = pure ["+RTS", "-O64M", "-RTS"]
|
|
| 41 | 42 | , hsLibrary = pure [ "-O" ]
|
| 42 | 43 | , hsCompiler = mconcat [ stage0 ? arg "-O2", notStage0 ? arg "-O"]
|
| 43 | 44 | , hsGhc = pure [ "-O", "-hide-all-packages" ]
|
| ... | ... | @@ -343,6 +343,7 @@ Library |
| 343 | 343 | |
| 344 | 344 | GHC.Internal.CString
|
| 345 | 345 | GHC.Internal.Classes
|
| 346 | + GHC.Internal.Classes.IP
|
|
| 346 | 347 | GHC.Internal.Debug
|
| 347 | 348 | GHC.Internal.Magic
|
| 348 | 349 | GHC.Internal.Magic.Dict
|
| 1 | 1 | {-# LANGUAGE Trustworthy #-}
|
| 2 | 2 | {-# LANGUAGE NoImplicitPrelude, MagicHash, StandaloneDeriving, BangPatterns,
|
| 3 | 3 | KindSignatures, DataKinds, ConstraintKinds,
|
| 4 | - MultiParamTypeClasses, FunctionalDependencies #-}
|
|
| 5 | -{-# LANGUAGE UnboxedTuples #-}
|
|
| 6 | -{-# LANGUAGE AllowAmbiguousTypes #-}
|
|
| 7 | - -- ip :: IP x a => a is strictly speaking ambiguous, but IP is magic
|
|
| 4 | + MultiParamTypeClasses, FunctionalDependencies,
|
|
| 5 | + UnboxedTuples #-}
|
|
| 6 | + |
|
| 8 | 7 | {-# LANGUAGE UndecidableSuperClasses #-}
|
| 9 | 8 | -- Because of the type-variable superclasses for tuples
|
| 10 | 9 | |
| ... | ... | @@ -142,6 +141,7 @@ import GHC.Internal.Prim |
| 142 | 141 | import GHC.Internal.Tuple
|
| 143 | 142 | import GHC.Internal.CString (unpackCString#)
|
| 144 | 143 | import GHC.Internal.Types
|
| 144 | +import GHC.Internal.Classes.IP
|
|
| 145 | 145 | |
| 146 | 146 | infix 4 ==, /=, <, <=, >=, >
|
| 147 | 147 | infixr 3 &&
|
| ... | ... | @@ -149,12 +149,6 @@ infixr 2 || |
| 149 | 149 | |
| 150 | 150 | default () -- Double isn't available yet
|
| 151 | 151 | |
| 152 | --- | The syntax @?x :: a@ is desugared into @IP "x" a@
|
|
| 153 | --- IP is declared very early, so that libraries can take
|
|
| 154 | --- advantage of the implicit-call-stack feature
|
|
| 155 | -class IP (x :: Symbol) a | x -> a where
|
|
| 156 | - ip :: a
|
|
| 157 | - |
|
| 158 | 152 | {- $matching_overloaded_methods_in_rules
|
| 159 | 153 | |
| 160 | 154 | Matching on class methods (e.g. @(==)@) in rewrite rules tends to be a bit
|
| 1 | +{-# LANGUAGE Trustworthy #-}
|
|
| 2 | +{-# LANGUAGE NoImplicitPrelude, MagicHash, StandaloneDeriving, BangPatterns,
|
|
| 3 | + KindSignatures, DataKinds, ConstraintKinds,
|
|
| 4 | + MultiParamTypeClasses, FunctionalDependencies #-}
|
|
| 5 | + |
|
| 6 | +{-# LANGUAGE AllowAmbiguousTypes, RoleAnnotations, IncoherentInstances #-}
|
|
| 7 | + -- LANGUAGE pragmas: see Note [IP: implicit parameter class]
|
|
| 8 | + |
|
| 9 | +{-# OPTIONS_HADDOCK not-home #-}
|
|
| 10 | +-----------------------------------------------------------------------------
|
|
| 11 | +-- |
|
|
| 12 | +-- Module : GHC.Internal.Classes.IP
|
|
| 13 | +-- Copyright : (c) The University of Glasgow, 1992-2002
|
|
| 14 | +-- License : see libraries/base/LICENSE
|
|
| 15 | +--
|
|
| 16 | +-- Maintainer : ghc-devs@haskell.org
|
|
| 17 | +-- Stability : internal
|
|
| 18 | +-- Portability : non-portable (GHC extensions)
|
|
| 19 | +--
|
|
| 20 | +-- Basic classes.
|
|
| 21 | +-- Do not import this module directly. It is an GHC internal only
|
|
| 22 | +-- module. Some of its contents are instead available from @Prelude@
|
|
| 23 | +-- and @GHC.Int@.
|
|
| 24 | +--
|
|
| 25 | +-----------------------------------------------------------------------------
|
|
| 26 | + |
|
| 27 | +module GHC.Internal.Classes.IP( IP(..)) where
|
|
| 28 | + |
|
| 29 | +import GHC.Internal.Types
|
|
| 30 | + |
|
| 31 | + |
|
| 32 | +default () -- Double isn't available yet
|
|
| 33 | + |
|
| 34 | +-- | The syntax @?x :: a@ is desugared into @IP "x" a@
|
|
| 35 | +-- IP is declared very early, so that libraries can take
|
|
| 36 | +-- advantage of the implicit-call-stack feature
|
|
| 37 | +type role IP nominal representational -- See (IPRoles)
|
|
| 38 | +class IP (x :: Symbol) a | x -> a where
|
|
| 39 | + ip :: a
|
|
| 40 | + |
|
| 41 | +{- Note [IP: implicit parameter class]
|
|
| 42 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
| 43 | +An implicit parameter constraint (?foo::ty) is just short for
|
|
| 44 | + |
|
| 45 | + IP "foo" ty
|
|
| 46 | + |
|
| 47 | +where ghc-internal:GHC.Internal.Classes.IP is a special class that
|
|
| 48 | +GHC knows about, defined in this module.
|
|
| 49 | + |
|
| 50 | +* It is a unary type class, with one method `ip`, so it has no cost.
|
|
| 51 | + For example, (?foo::Int) is represented just by an Int.
|
|
| 52 | + |
|
| 53 | +* Criticially, it has a functional dependency:
|
|
| 54 | + class IP (x :: Symbol) a | x -> a where ...
|
|
| 55 | + So if we have
|
|
| 56 | + [G] IP "foo" Int
|
|
| 57 | + [W] IP "foo" alpha
|
|
| 58 | + the fundep wil lgive us alpha ~ Int, as desired.
|
|
| 59 | + |
|
| 60 | +* The solver has a number of special cases for implicit parameters,
|
|
| 61 | + mainly because a binding (let ?foo::Int = rhs in body)
|
|
| 62 | + is like a local instance declaration for IP. Search for uses
|
|
| 63 | + of `isIPClass`.
|
|
| 64 | + |
|
| 65 | +Wrinkles
|
|
| 66 | + |
|
| 67 | +(IPAmbiguity) The single method of IP has an ambiguous type
|
|
| 68 | + ip :: forall a. IP s a => a
|
|
| 69 | + Hence the LANGUAGE pragama AllowAmbiguousTypes.
|
|
| 70 | + The method `ip` is never called by the user, so ambiguity doesn't matter.
|
|
| 71 | + |
|
| 72 | +(IPRoles) IP has a role annotation. Why? See #26737. We want
|
|
| 73 | + [W] IP "foo" t1 ~R# IP "foo" t2
|
|
| 74 | + to decompose to give [W] IP t1 ~R# t2, using /representational/
|
|
| 75 | + equality for (t1 ~R# t2) not nominal.
|
|
| 76 | + |
|
| 77 | + This usually gives a complaint about incoherence, because in general
|
|
| 78 | + (t1 ~R# t2) does NOT imply (C t1) ~R# (C t2) for any normal class.
|
|
| 79 | + But it does for IP, because instance selection is controlled by the Symbol,
|
|
| 80 | + not the type of the payload. Hence LANGUAGE pragma IncoherentInstances.
|
|
| 81 | + (It is unfortunate that we need a module-wide IncoherentInstances here;
|
|
| 82 | + see #17167.)
|
|
| 83 | + |
|
| 84 | + Side note: arguably this treatment could be applied to any class
|
|
| 85 | + with a functional dependency; but for now we restrict it to IP.
|
|
| 86 | +-}
|
|
| 87 | + |
| 1 | - |
|
| 2 | -LIBRARY "libHSffi-ghc@ProjectVersion@.dll"
|
|
| 3 | - |
|
| 4 | -EXPORTS
|
|
| 5 | - |
|
| 6 | - ffi_prep_cif
|
|
| 7 | - ffi_call
|
|
| 8 | - ffi_type_void
|
|
| 9 | - ffi_type_float
|
|
| 10 | - ffi_type_double
|
|
| 11 | - ffi_type_sint64
|
|
| 12 | - ffi_type_uint64
|
|
| 13 | - ffi_type_sint32
|
|
| 14 | - ffi_type_uint32
|
|
| 15 | - ffi_type_sint16
|
|
| 16 | - ffi_type_uint16
|
|
| 17 | - ffi_type_sint8
|
|
| 18 | - ffi_type_uint8
|
|
| 19 | - ffi_type_pointer |
| 1 | - |
|
| 2 | -LIBRARY "libHSghc-internal-@LibVersion@-ghc@ProjectVersion@.dll"
|
|
| 3 | - |
|
| 4 | -EXPORTS
|
|
| 5 | - ghczminternal_GHCziInternalziInt_I8zh_con_info
|
|
| 6 | - ghczminternal_GHCziInternalziInt_I16zh_con_info
|
|
| 7 | - ghczminternal_GHCziInternalziInt_I32zh_con_info
|
|
| 8 | - ghczminternal_GHCziInternalziInt_I64zh_con_info
|
|
| 9 | - |
|
| 10 | - ghczminternal_GHCziInternalziWord_W8zh_con_info
|
|
| 11 | - ghczminternal_GHCziInternalziWord_W16zh_con_info
|
|
| 12 | - ghczminternal_GHCziInternalziWord_W32zh_con_info
|
|
| 13 | - ghczminternal_GHCziInternalziWord_W64zh_con_info
|
|
| 14 | - |
|
| 15 | - ghczminternal_GHCziInternalziStable_StablePtr_con_info
|
|
| 16 | - |
|
| 17 | - ghczminternal_GHCziInternalziPack_unpackCString_closure
|
|
| 18 | - |
|
| 19 | - ghczminternal_GHCziInternalziTopHandler_runIO_closure
|
|
| 20 | - ghczminternal_GHCziInternalziTopHandler_runNonIO_closure
|
|
| 21 | - |
|
| 22 | - ghczminternal_GHCziInternalziIOziException_stackOverflow_closure
|
|
| 23 | - ghczminternal_GHCziInternalziIOziException_heapOverflow_closure
|
|
| 24 | - |
|
| 25 | - ghczminternal_GHCziInternalziPtr_Ptr_con_info
|
|
| 26 | - ghczminternal_GHCziInternalziPtr_FunPtr_con_info
|
|
| 27 | - |
|
| 28 | - ghczminternal_GHCziInternalziConcziIO_ensureIOManagerIsRunning_closure
|
|
| 29 | - ghczminternal_GHCziInternalziConcziIO_interruptIOManager_closure
|
|
| 30 | - ghczminternal_GHCziInternalziConcziIO_ioManagerCapabilitiesChanged_closure
|
|
| 31 | - ghczminternal_GHCziInternalziConcziSync_runSparks_closure
|
|
| 32 | - ghczminternal_GHCziInternalziEventziWindows_processRemoteCompletion_closure
|
|
| 33 | - |
|
| 34 | - ghczminternal_GHCziInternalziTopHandler_flushStdHandles_closure
|
|
| 35 | - |
|
| 36 | - ghczminternal_GHCziInternalziWeakziFinalizze_runFinalizzerBatch_closure
|
|
| 37 | - ghczminternal_GHCziInternalziPack_unpackCString_closure
|
|
| 38 | - ghczminternal_GHCziInternalziIOziException_blockedIndefinitelyOnMVar_closure
|
|
| 39 | - ghczminternal_GHCziInternalziIOziException_blockedIndefinitelyOnSTM_closure
|
|
| 40 | - ghczminternal_GHCziInternalziIOziException_allocationLimitExceeded_closure
|
|
| 41 | - ghczminternal_GHCziInternalziIOziException_stackOverflow_closure
|
|
| 42 | - ghczminternal_GHCziInternalziIOziException_cannotCompactFunction_closure
|
|
| 43 | - ghczminternal_GHCziInternalziIOziException_cannotCompactPinned_closure
|
|
| 44 | - ghczminternal_GHCziInternalziIOziException_cannotCompactMutable_closure
|
|
| 45 | - ghczminternal_GHCziInternalziControlziExceptionziBase_nonTermination_closure
|
|
| 46 | - ghczminternal_GHCziInternalziControlziExceptionziBase_nestedAtomically_closure
|
|
| 47 | - ghczminternal_GHCziInternalziExceptionziType_divZZeroException_closure
|
|
| 48 | - ghczminternal_GHCziInternalziExceptionziType_underflowException_closure
|
|
| 49 | - ghczminternal_GHCziInternalziExceptionziType_overflowException_closure |
| 1 | - |
|
| 2 | -LIBRARY "libHSghc-internal-@LibVersion@-ghc@ProjectVersion@.dll"
|
|
| 3 | - |
|
| 4 | -EXPORTS
|
|
| 5 | - |
|
| 6 | - ghczminternal_GHCziInternalziTypes_True_closure
|
|
| 7 | - ghczminternal_GHCziInternalziTypes_False_closure
|
|
| 8 | - ghczminternal_GHCziInternalziTypes_Czh_con_info
|
|
| 9 | - ghczminternal_GHCziInternalziTypes_Izh_con_info
|
|
| 10 | - ghczminternal_GHCziInternalziTypes_Fzh_con_info
|
|
| 11 | - ghczminternal_GHCziInternalziTypes_Dzh_con_info
|
|
| 12 | - ghczminternal_GHCziInternalziTypes_Wzh_con_info
|
|
| 13 | - ghczminternal_GHCziInternalziTypes_Czh_static_info
|
|
| 14 | - ghczminternal_GHCziInternalziTypes_Izh_static_info |
| ... | ... | @@ -3293,6 +3293,7 @@ module GHC.Base where |
| 3293 | 3293 | {-# MINIMAL fmap #-}
|
| 3294 | 3294 | type IO :: * -> *
|
| 3295 | 3295 | newtype IO a = IO (State# RealWorld -> (# State# RealWorld, a #))
|
| 3296 | + type role IP nominal representational
|
|
| 3296 | 3297 | type IP :: Symbol -> * -> Constraint
|
| 3297 | 3298 | class IP x a | x -> a where
|
| 3298 | 3299 | ip :: a
|
| ... | ... | @@ -3293,6 +3293,7 @@ module GHC.Base where |
| 3293 | 3293 | {-# MINIMAL fmap #-}
|
| 3294 | 3294 | type IO :: * -> *
|
| 3295 | 3295 | newtype IO a = IO (State# RealWorld -> (# State# RealWorld, a #))
|
| 3296 | + type role IP nominal representational
|
|
| 3296 | 3297 | type IP :: Symbol -> * -> Constraint
|
| 3297 | 3298 | class IP x a | x -> a where
|
| 3298 | 3299 | ip :: a
|
| ... | ... | @@ -3293,6 +3293,7 @@ module GHC.Base where |
| 3293 | 3293 | {-# MINIMAL fmap #-}
|
| 3294 | 3294 | type IO :: * -> *
|
| 3295 | 3295 | newtype IO a = IO (State# RealWorld -> (# State# RealWorld, a #))
|
| 3296 | + type role IP nominal representational
|
|
| 3296 | 3297 | type IP :: Symbol -> * -> Constraint
|
| 3297 | 3298 | class IP x a | x -> a where
|
| 3298 | 3299 | ip :: a
|
| ... | ... | @@ -1171,6 +1171,7 @@ module GHC.Classes where |
| 1171 | 1171 | (==) :: a -> a -> GHC.Internal.Types.Bool
|
| 1172 | 1172 | (/=) :: a -> a -> GHC.Internal.Types.Bool
|
| 1173 | 1173 | {-# MINIMAL (==) | (/=) #-}
|
| 1174 | + type role IP nominal representational
|
|
| 1174 | 1175 | type IP :: GHC.Internal.Types.Symbol -> * -> Constraint
|
| 1175 | 1176 | class IP x a | x -> a where
|
| 1176 | 1177 | ip :: a
|
| ... | ... | @@ -1171,6 +1171,7 @@ module GHC.Classes where |
| 1171 | 1171 | (==) :: a -> a -> GHC.Internal.Types.Bool
|
| 1172 | 1172 | (/=) :: a -> a -> GHC.Internal.Types.Bool
|
| 1173 | 1173 | {-# MINIMAL (==) | (/=) #-}
|
| 1174 | + type role IP nominal representational
|
|
| 1174 | 1175 | type IP :: GHC.Internal.Types.Symbol -> * -> Constraint
|
| 1175 | 1176 | class IP x a | x -> a where
|
| 1176 | 1177 | ip :: a
|
| 1 | -Main.funcToReify :: GHC.Internal.Classes.IP "z"
|
|
| 2 | - GHC.Internal.Types.Int =>
|
|
| 1 | +Main.funcToReify :: GHC.Internal.Classes.IP.IP "z"
|
|
| 2 | + GHC.Internal.Types.Int =>
|
|
| 3 | 3 | GHC.Internal.Types.Int
|
| 4 | 4 | 5
|
| 5 | 5 | 1
|
| 1 | +{-# LANGUAGE ImpredicativeTypes, ImplicitParams #-}
|
|
| 2 | + |
|
| 3 | +module T26737 where
|
|
| 4 | + |
|
| 5 | +import Data.Coerce
|
|
| 6 | + |
|
| 7 | +newtype Foo = MkFoo Int
|
|
| 8 | + |
|
| 9 | +b :: ((?foo :: Foo) => Int) -> ((?foo :: Int) => Int)
|
|
| 10 | +b = coerce @(((?foo :: Foo) => Int)) @(((?foo :: Int) => Int)) |
| ... | ... | @@ -958,3 +958,4 @@ test('T14745', normal, compile, ['']) |
| 958 | 958 | test('T26451', normal, compile, [''])
|
| 959 | 959 | test('T26582', normal, compile, [''])
|
| 960 | 960 | test('T26746', normal, compile, [''])
|
| 961 | +test('T26737', normal, compile, ['']) |