-- Note that readPVar and readPVarIO must be strict in RDV in order to force
-- the initial, lazy read from the database. This is the only reason for RDV.
-- Without forcing here, a lazy read might return a value from an update.

-- | Read a PVar in the IO monad. 
--
-- This is more efficient than a full transaction. It simply peeks at
-- the underlying TVar with readTVarIO. Durability of the value read
-- is not guaranteed. 
readPVarIO :: PVar a -> IO a
readPVarIO pv = 
    readTVarIO (pvar_data pv) >>= \ rdv ->
    case rdv of { (RDV v) -> return v }
readPVarIO :: PVar a -> IO a
readPVarIO pv = 
    readTVarIO (pvar_data pv) >>= \ rdv ->
    case rdv of { (RDV v) -> return v }
readPVarIO pv = 
    readTVarIO (pvar_data pv) >>= \ rdv ->
    case rdv of { (RDV v) -> return v }