Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个在并行线程中不断增长的列表,例如在内部IORef [a]或MVar [a]. 我也想将它并行下沉,直到线程退出。我应该如何实现这个?它可能看起来像这样:
IORef [a]
MVar [a]
main = do list <- newIORef [] forkIO $ grow list ... result <- ... $$ sinkHash return result
或者,也许有一种更好的方法,而不需要增加一个列表并直接一个接一个地沉入线程内产生的每个块?