Safe Haskell | None |
---|
Documentation
newReference :: (Object obj, Object callback) => obj -> Maybe callback -> IO ReferenceSource
Return a weak reference for the object. This will always return a new
reference, but is not guaranteed to create a new object; an existing
reference object may be returned. The second parameter, callback, can
be a callable object that receives notification when obj is garbage
collected; it should accept a single parameter, which will be the weak
reference object itself. If ob is not a weakly-referencable object, or if
callback is not callable, this will throw a TypeError
.
newProxy :: (Object obj, Object callback) => obj -> Maybe callback -> IO ProxySource
Return a weak reference proxy for the object. This will always return a
new reference, but is not guaranteed to create a new object; an existing
proxy may be returned. The second parameter, callback, can be a callable
object that receives notification when obj is garbage collected; it
should accept a single parameter, which will be the weak reference object
itself. If ob is not a weakly-referencable object, or if callback is not
callable, this will throw a TypeError
.
getObject :: Reference -> IO SomeObjectSource
Return the referenced object from a weak reference. If the referent is
no longer live, returns None
.