~ubuntu-branches/ubuntu/precise/ghc/precise

« back to all changes in this revision

Viewing changes to libraries/haskell2010/Foreign/StablePtr.hs

  • Committer: Bazaar Package Importer
  • Author(s): Joachim Breitner
  • Date: 2011-01-17 12:49:24 UTC
  • Revision ID: james.westby@ubuntu.com-20110117124924-do1pym1jlf5o636m
Tags: upstream-7.0.1
ImportĀ upstreamĀ versionĀ 7.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
module Foreign.StablePtr
 
2
        ( -- * Stable references to Haskell values
 
3
          StablePtr          -- abstract
 
4
        , newStablePtr       -- :: a -> IO (StablePtr a)
 
5
        , deRefStablePtr     -- :: StablePtr a -> IO a
 
6
        , freeStablePtr      -- :: StablePtr a -> IO ()
 
7
        , castStablePtrToPtr -- :: StablePtr a -> Ptr ()
 
8
        , castPtrToStablePtr -- :: Ptr () -> StablePtr a
 
9
        , -- ** The C-side interface
 
10
 
 
11
          -- $cinterface
 
12
  ) where
 
13
import "base" Foreign.StablePtr as This___
 
14
 
 
15
-- $cinterface
 
16
--
 
17
-- The following definition is available to C programs inter-operating with
 
18
-- Haskell code when including the header @HsFFI.h@.
 
19
--
 
20
-- > typedef void *HsStablePtr;  /* C representation of a StablePtr */
 
21
--
 
22
-- Note that no assumptions may be made about the values representing stable
 
23
-- pointers.  In fact, they need not even be valid memory addresses.  The only
 
24
-- guarantee provided is that if they are passed back to Haskell land, the
 
25
-- function 'deRefStablePtr' will be able to reconstruct the
 
26
-- Haskell value referred to by the stable pointer.