[commit: ghc] ghc-8.2: Document mkWeak# (933fb44)

git at git.haskell.org git at git.haskell.org
Thu Apr 27 20:10:39 UTC 2017


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

On branch  : ghc-8.2
Link       : http://ghc.haskell.org/trac/ghc/changeset/933fb440ad4adba542975fc5d8b46c1f666ff2ce/ghc

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

commit 933fb440ad4adba542975fc5d8b46c1f666ff2ce
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
    
    (cherry picked from commit 244602697c30e03ba63076941e4742ceeb78dd7c)


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

933fb440ad4adba542975fc5d8b46c1f666ff2ce
 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 e9c844e..ef83efb 100644
--- a/compiler/prelude/primops.txt.pp
+++ b/compiler/prelude/primops.txt.pp
@@ -2368,6 +2368,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