on master help sign in
Add some comments
commit6fd665167e700d59bbd68d4066f0d60ac505065a authorHarendra Kumar <harendra.kumar@gmail.com> dateTue 20 Jun 2017, 18:17 (9 years ago) parentda2491d
1 file changed+5−3
src/Duct/AsyncT.hs+5−3
src/Duct/AsyncT.hs+5−3
@@ -105,9 +105,9 @@ stop = empty
105105instance Monad m => Monad (AsyncT m) where
106106 return = pure
107107
108− -- Inner bind operations in 'm' add their 'f' to fstack. If we migrate to
109− -- a new thread somewhere in the middle we unwind the fstack and run these
110− -- functions manually after migration.
108+ -- Inner bind-operations in 'm' add their 'f' to fstack. If we migrate the
109+ -- context to a new thread, somewhere in the middle, we unwind the fstack
110+ -- and run these functions when we resume the context after migration.
111111 m >>= f = AsyncT $ do
112112 saveContext m f
113113 runAsyncT m >>= restoreContext >>= runAsyncT
@@ -183,6 +183,8 @@ runContext t = do
183183 pendingRef <- liftIO $ newIORef []
184184 credit <- liftIO $ newIORef maxBound
185185
186+ -- XXX this should be moved to Context.hs and then we can make m existential
187+ -- and remove the unsafeCoerces
186188 r <- runStateT (runAsyncT t) $ initContext
187189 (empty :: AsyncT m a) childChan pendingRef credit
188190