@@ -19,7 +19,7 @@ module Asyncly.Core
19 ( Stream (..)
19 ( Stream (..)
20 , MonadAsync
20 , MonadAsync
21 , Streaming (..)
21 , Streaming (..)
22− , ContextUsedAfterEOF (..)
22+ , EndOfStream (..)
24 -- * Running the Monad
24 -- * Running the Monad
25 , runStreaming
25 , runStreaming
@@ -304,8 +304,8 @@ sendWorkerWait ctx = do
304 else void (liftIO $ takeMVar (doorBell ctx))
304 else void (liftIO $ takeMVar (doorBell ctx))
306-- | An 'async' stream has finished but is still being used.
306-- | An 'async' stream has finished but is still being used.
307−data ContextUsedAfterEOF = ContextUsedAfterEOF deriving Show
307+data EndOfStream = EndOfStream deriving Show
308−instance Exception ContextUsedAfterEOF
308+instance Exception EndOfStream
310-- | Pull a stream from a context
310-- | Pull a stream from a context
311{-# NOINLINE pullFromCtx #-}
311{-# NOINLINE pullFromCtx #-}
@@ -317,7 +317,7 @@ pullFromCtx ctx = Stream $ \_ stp yld -> do
317 -- XXX if reading the IORef is costly we can use a flag in the context to
317 -- XXX if reading the IORef is costly we can use a flag in the context to
318 -- indicate we are done.
318 -- indicate we are done.
319 done <- allThreadsDone ctx
319 done <- allThreadsDone ctx
320− when done $ throwM ContextUsedAfterEOF
320+ when done $ throwM EndOfStream
322 res <- liftIO $ tryTakeMVar (doorBell ctx)
322 res <- liftIO $ tryTakeMVar (doorBell ctx)
323 when (isNothing res) $ sendWorkerWait ctx
323 when (isNothing res) $ sendWorkerWait ctx