Safe Haskell | None |
---|---|
Language | Haskell2010 |
Documentation
loop :: Member (Queue d) r => (d -> Sem r ()) -> Sem r () Source #
Read from a Queue
repeatedly until it is closed.
When an element is received, call action
and recurse.
data Queue d :: Effect Source #
Abstracts queues like TBQueue
.
For documentation on the constructors, see the module Polysemy.Conc.Data.Queue.
import Polysemy.Conc (Queue, QueueResult) import Polysemy.Conc.Effect.Queue as Queue prog :: Member (Queue Int) r => Sem r (QueueResult Int) prog = do Queue.write 5 Queue.write 10 Queue.read >>= \case QueueResult.Success i -> fmap (i +) <$> Queue.read r -> pure r
Instances
type DefiningModule Queue Source # | |
Defined in Polysemy.Conc.Effect.Queue |