You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Something like this was requested in #7, and I think it could be supported fairly easily, and would likely simplify implementations of purescript-concurrent-queues since all the queue machinery exists in AVar anyway.
dataOperation=Ignore-- Do nothing with the queue
| FailError-- Propagate an exception to the callback
| HaltError-- Kill the internal queue and propagate the exception
| PushHead-- Push callback onto the head
| PushTail-- Push callback onto the tail
| DropHeadError-- Drop the head, and push onto the tail
| DropTailError-- Drop the tail, and push onto the head
| SwapHeadError-- Replace the head
| SwapTailError-- Replace the tailwindowPut::forallab. (Int->Operation) ->a->AVara->AVarCallbackUnit->Effect (EffectUnit)
This would have variations for windowTake, tryWindowPut. tryWindowTake isn't necessary. It would be straightforward to implement queue strategies on top, which could be bundled up as newtypes in a separate library.
putMax::foralla. Int->Error->a->AVara->AVarCallbackUnit->Effect (EffectUnit)
putMax max err = windowPut go
where
go n
| n < max = PushTail
| otherwise = Fail err
putSliding::foralla. Int->Error->a->AVara->AVarCallbackUnit->Effect (EFfectUnit)
putSliding max err = windowPut go
where
go n
| n < max = PushTail
| otherwise = DropHead err
Something like this was requested in #7, and I think it could be supported fairly easily, and would likely simplify implementations of
purescript-concurrent-queues
since all the queue machinery exists in AVar anyway.This would have variations for
windowTake
,tryWindowPut
.tryWindowTake
isn't necessary. It would be straightforward to implement queue strategies on top, which could be bundled up as newtypes in a separate library./cc @felixSchl @kritzcreek
The text was updated successfully, but these errors were encountered: