[commit: ghc] master: base: Improve documentation of indexArray# (15ece72)

git at git.haskell.org git at git.haskell.org
Thu May 31 02:06:06 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/15ece727d0cce777880ec2e3a1b3061f35dfce2c/ghc

>---------------------------------------------------------------

commit 15ece727d0cce777880ec2e3a1b3061f35dfce2c
Author: Andrew Martin <andrew.thaddeus at gmail.com>
Date:   Fri Apr 20 12:58:54 2018 -0400

    base: Improve documentation of indexArray#


>---------------------------------------------------------------

15ece727d0cce777880ec2e3a1b3061f35dfce2c
 compiler/prelude/primops.txt.pp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp
index 9165c6f..8eb39c3 100644
--- a/compiler/prelude/primops.txt.pp
+++ b/compiler/prelude/primops.txt.pp
@@ -829,8 +829,13 @@ primop  SizeofMutableArrayOp "sizeofMutableArray#" GenPrimOp
 
 primop  IndexArrayOp "indexArray#" GenPrimOp
    Array# a -> Int# -> (# a #)
-   {Read from specified index of immutable array. Result is packaged into
-    an unboxed singleton; the result itself is not yet evaluated.}
+   {Read from the specified index of an immutable array. The result is packaged
+    into an unboxed unary tuple; the result itself is not yet
+    evaluated. Pattern matching on the tuple forces the indexing of the
+    array to happen but does not evaluate the element itself. Evaluating
+    the thunk prevents additional thunks from building up on the
+    heap. Avoiding these thunks, in turn, reduces references to the
+    argument array, allowing it to be garbage collected more promptly.}
    with
    can_fail         = True
 



More information about the ghc-commits mailing list