Module

Specular.Internal.Queue

Package
purescript-specular
Repository
restaumatic/purescript-specular

#Queue Source

data Queue t0

A mutable FIFO queue.

#new Source

new :: forall a. Effect (Queue a)

Create a new empty queue.

#enqueue Source

enqueue :: forall a. EffectFn2 (Queue a) a Unit

Add an element onto the end of the queue.

#drain Source

drain :: forall a. EffectFn2 (Queue a) (EffectFn1 a Unit) Unit

Iterate over the queue, calling the specified function on each element in sequence.

Postcondition: When drain returns, the queue is empty.

If the function calls enqueue, the newly added elements will be processed in the run of drain.

If the function calls drain, the inner drain will consume all elements and it will be the last invocation of the callback function in the outer drain.