@@ -45,7 +45,7 @@ import Duct.Event
4545
4646-- import Debug.Trace
4747
48−newtype AsyncT m a = AsyncT { runAsyncT :: StateT EventF m (Maybe a) }
48+newtype AsyncT m a = AsyncT { runAsyncT :: StateT Context m (Maybe a) }
4949
5050------------------------------------------------------------------------------
5151-- Remote data types
@@ -148,10 +148,10 @@ instance Monad m => Monad (AsyncT m) where
148148 -- Save the 'm' and 'f', in case we migrate to a new thread before this
149149 -- bind operation completes, we run the operation manually in the new
150150 -- thread.
151− modify $ \EventF { fstack = fs, .. } ->
152− EventF { currentm = unsafeCoerce m
153− , fstack = unsafeCoerce f : fs
154− , .. }
151+ modify $ \Context { fstack = fs, .. } ->
152+ Context { currentm = unsafeCoerce m
153+ , fstack = unsafeCoerce f : fs
154+ , .. }
155155
156156 -- Inner bind operations in 'm' add their 'f' to fstack. If we migrate to
157157 -- a new thread somewhere in the middle we unwind the fstack and run these
@@ -162,10 +162,10 @@ instance Monad m => Monad (AsyncT m) where
162162 Nothing -> empty
163163 Just x -> f x
164164
165− modify $ \EventF { fstack = fs, .. } ->
166− EventF { currentm = unsafeCoerce res
167− , fstack = tailsafe fs
168− , .. }
165+ modify $ \Context { fstack = fs, .. } ->
166+ Context { currentm = unsafeCoerce res
167+ , fstack = tailsafe fs
168+ , .. }
169169
170170 runAsyncT res
171171
@@ -242,7 +242,7 @@ instance MonadTrans AsyncT where
242242 lift mx = AsyncT $ lift mx >>= return . Just
243243
244244instance MonadTransControl AsyncT where
245− type StT AsyncT a = (Maybe a, EventF)
245+ type StT AsyncT a = (Maybe a, Context)
246246 liftWith f = AsyncT $ StateT $ \s ->
247247 liftM (\x -> (Just x, s))
248248 (f $ \t -> runStateT (runAsyncT t) s)
@@ -284,13 +284,13 @@ waitForChildren chan pendingRef = do
284284------------------------------------------------------------------------------
285285
286286-- | Run a transient computation with a default initial state
287−runTransient :: forall m a. MonadIO m => AsyncT m a -> m (Maybe a, EventF)
287+runTransient :: forall m a. MonadIO m => AsyncT m a -> m (Maybe a, Context)
288288runTransient t = do
289289 childChan <- liftIO $ atomically newTChan
290290 pendingRef <- liftIO $ newIORef []
291291 credit <- liftIO $ newIORef maxBound
292292
293− r <- runStateT (runAsyncT t) $ initEventF
293+ r <- runStateT (runAsyncT t) $ initContext
294294 (empty :: AsyncT m a) childChan pendingRef credit
295295
296296 waitForChildren childChan pendingRef
@@ -362,7 +362,7 @@ delSData x = AsyncT $ delData x >> return (Just ())
362362-- MonadState for AsyncT m
363363------------------------------------------------------------------------------
364364
365−instance (Monad m, Monad (AsyncT m)) => MonadState EventF (AsyncT m) where
365+instance (Monad m, Monad (AsyncT m)) => MonadState Context (AsyncT m) where
366366 get = AsyncT $ get >>= return . Just
367367 put x = AsyncT $ put x >> return (Just ())
368368 state f = AsyncT $ do