import Control.Concurrent.STM (atomically) import Control.Concurrent.STM.TQueue (TQueue, writeTQueue)Having accessed the underlying queue you can write items, wrapped in Just, to it directly:
liftIO $ do atomically $ do writeTQueue queue (Just item)A Nothing written to the underlying queue will signal the worker threads that the end of input has been reached and they can safely return.