[commit: ghc] master: Document mkWeak# (2446026)

git at git.haskell.org git at git.haskell.org
Wed Apr 26 01:11:59 UTC 2017


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/244602697c30e03ba63076941e4742ceeb78dd7c/ghc

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

commit 244602697c30e03ba63076941e4742ceeb78dd7c
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Tue Apr 25 18:39:58 2017 -0400

    Document mkWeak#
    
    Reviewers: simonmar, austin
    
    Reviewed By: simonmar
    
    Subscribers: RyanGlScott, rwbarton, thomie
    
    GHC Trac Issues: #10640, #13611
    
    Differential Revision: https://phabricator.haskell.org/D3498


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

244602697c30e03ba63076941e4742ceeb78dd7c
 compiler/prelude/primops.txt.pp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp
index 8c9cc92..255235a 100644
--- a/compiler/prelude/primops.txt.pp
+++ b/compiler/prelude/primops.txt.pp
@@ -2382,6 +2382,11 @@ primtype Weak# b
 primop  MkWeakOp "mkWeak#" GenPrimOp
    o -> b -> (State# RealWorld -> (# State# RealWorld, c #))
      -> State# RealWorld -> (# State# RealWorld, Weak# b #)
+   { {\tt mkWeak# k v finalizer s} creates a weak reference to value {\tt k},
+     with an associated reference to some value {\tt v}. If {\tt k} is still
+     alive then {\tt v} can be retrieved using {\tt deRefWeak#}. Note that
+     the type of {\tt k} must be represented by a pointer (i.e. of kind {\tt
+     TYPE 'LiftedRep} or {\tt TYPE 'UnliftedRep}). }
    with
    has_side_effects = True
    out_of_line      = True



More information about the ghc-commits mailing list