summaryrefslogtreecommitdiff
path: root/libraries/ghc-prim
diff options
context:
space:
mode:
authorAndrew Martin <andrew.thaddeus@gmail.com>2019-08-19 08:18:19 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-10-26 05:19:38 -0400
commit8916e64e5437c99b82d5610286430328af1d86bc (patch)
tree3c9f00fbed65cb725b57acb0ee7b83d776475a89 /libraries/ghc-prim
parentacedfc8b8706a92127c96f487e3e3b1636451704 (diff)
downloadhaskell-8916e64e5437c99b82d5610286430328af1d86bc.tar.gz
Implement shrinkSmallMutableArray# and resizeSmallMutableArray#.
This is a part of GHC Proposal #25: "Offer more array resizing primitives". Resources related to the proposal: - Discussion: https://github.com/ghc-proposals/ghc-proposals/pull/121 - Proposal: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0025-resize-boxed.rst Only shrinkSmallMutableArray# is implemented as a primop since a library-space implementation of resizeSmallMutableArray# (in GHC.Exts) is no less efficient than a primop would be. This may be replaced by a primop in the future if someone devises a strategy for growing arrays in-place. The library-space implementation always copies the array when growing it. This commit also tweaks the documentation of the deprecated sizeofMutableByteArray#, removing the mention of concurrency. That primop is unsound even in single-threaded applications. Additionally, the non-negativity assertion on the existing shrinkMutableByteArray# primop has been removed since this predicate is trivially always true.
Diffstat (limited to 'libraries/ghc-prim')
-rw-r--r--libraries/ghc-prim/changelog.md9
1 files changed, 9 insertions, 0 deletions
diff --git a/libraries/ghc-prim/changelog.md b/libraries/ghc-prim/changelog.md
index 4967971e67..411d118aa1 100644
--- a/libraries/ghc-prim/changelog.md
+++ b/libraries/ghc-prim/changelog.md
@@ -2,6 +2,15 @@
- Shipped with GHC 8.10.1
+- Add primop for shrinking `SmallMutableArray#`
+ to `GHC.Prim`:
+
+ shrinkSmallMutableArray# :: SmallMutableArray# s a -> Int# -> State# s -> State# s
+
+ Note that `resizeSmallMutableArray#` is not included as
+ as primitive. It has been implemented in library space in
+ `GHC.Exts`. See the release notes of `base`.
+
- Added to `GHC.Prim`:
closureSize# :: a -> Int#