-- Global references; state
--
  Author :  
-----------------------------------------------------------------------------

module Control.Parallel.HdpH.Internal.State.GRef
  ( -- * reference to this node's registry
    regRef  -- :: IORef GRefReg
  ) where

import Prelude
import Data.IORef (IORef, newIORef)
import qualified Data.Map as Map (empty)
import System.IO.Unsafe (unsafePerformIO)

import Control.Parallel.HdpH.Internal.Type.GRef
       (GRefReg(GRefReg), lastSlot, table)


-----------------------------------------------------------------------------
-- reference to this node's registry, initially empty

regRef :: IORef GRefReg
regRef = unsafePerformIO $
           newIORef $ GRefReg { lastSlot = 0, table = Map.empty }
  required to protect unsafePerformIO hack

 Global references; state

---------------------------------------------------------------------------
 * reference to this node's registry
 :: IORef GRefReg
---------------------------------------------------------------------------
 reference to this node's registry, initially empty
  Author :  

module Control.Parallel.HdpH.Internal.State.GRef
  ) where

import Prelude
import Data.IORef (IORef, newIORef)
import qualified Data.Map as Map (empty)
import System.IO.Unsafe (unsafePerformIO)

import Control.Parallel.HdpH.Internal.Type.GRef
       (GRefReg(GRefReg), lastSlot, table)



regRef :: IORef GRefReg
regRef = unsafePerformIO $
           newIORef $ GRefReg { lastSlot = 0, table = Map.empty }
  required to protect unsafePerformIO hack
