summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2023-03-23 12:47:15 -0400
committerBen Gamari <ben@smart-cactus.org>2023-05-09 20:40:14 -0400
commita6e07e0316e2dcfcc2f76b1c5fa0ff04a4ee0e6b (patch)
treef000349735a1d6b5c51db2df3c0dc60a57f003a2
parentb2cdb7dacc095142e29c0f28a956b7fa97cdb4b1 (diff)
downloadhaskell-wip/T23163.tar.gz
ghc-prim: Generalize keepAlive#/touch# in state token typewip/T23163
Closes #23163.
-rw-r--r--compiler/GHC/Builtin/primops.txt.pp4
-rw-r--r--libraries/ghc-prim/changelog.md2
2 files changed, 4 insertions, 2 deletions
diff --git a/compiler/GHC/Builtin/primops.txt.pp b/compiler/GHC/Builtin/primops.txt.pp
index 559b8a972d..5b730c1943 100644
--- a/compiler/GHC/Builtin/primops.txt.pp
+++ b/compiler/GHC/Builtin/primops.txt.pp
@@ -3407,7 +3407,7 @@ primop FinalizeWeakOp "finalizeWeak#" GenPrimOp
out_of_line = True
primop TouchOp "touch#" GenPrimOp
- v -> State# RealWorld -> State# RealWorld
+ v -> State# s -> State# s
with
code_size = { 0 }
has_side_effects = True
@@ -3723,7 +3723,7 @@ section "Controlling object lifetime"
-- and "p" is the same as "b" except representation-polymorphic.
-- See Note [Levity and representation polymorphic primops]
primop KeepAliveOp "keepAlive#" GenPrimOp
- v -> State# RealWorld -> (State# RealWorld -> p) -> p
+ v -> State# s -> (State# s -> p) -> p
{ @'keepAlive#' x s k@ keeps the value @x@ alive during the execution
of the computation @k@.
diff --git a/libraries/ghc-prim/changelog.md b/libraries/ghc-prim/changelog.md
index 221325c029..1cf411c029 100644
--- a/libraries/ghc-prim/changelog.md
+++ b/libraries/ghc-prim/changelog.md
@@ -14,6 +14,8 @@
- `sameMutVar#`, `sameTVar#`, `sameMVar#`
- `sameIOPort#`, `eqStableName#`.
+- `keepAlive#` and `touch#` are now polymorphic in their state token (#23163; [CLC#152](https://github.com/haskell/core-libraries-committee/issues/152))
+
- Several new primops were added:
- `copyMutableByteArrayNonOverlapping#`