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
Make ring buffer a first class streaming citizen by providing read unfold and write fold for it just like array. That will enable us to use ringbuffers more e.g. lastN can actually return a ringbuffer instead of array.
The text was updated successfully, but these errors were encountered:
Currently, the user-facing APIs of the ring buffer are not very safe. It's very
easy to shoot yourself in the foot when uninitialized elements are involved.
The internal representation can be extended to keep track of things
like ringLength, ringHead, etc.
Possibly,
data Ring a = Ring
{ ringContents :: {-# UNPACK #-} !MutByteArray
, ringHead :: {-# UNPACK #-} !Int -- ^ Write index
, ringTail :: {-# UNPACK #-} !Int -- ^ Read index
, ringLength :: {-# UNPACK #-} !Int -- ^ Buffer length
, ringCapacity :: {-# UNPACK #-} !Int -- ^ Buffer capacity
}
Make ring buffer a first class streaming citizen by providing read unfold and write fold for it just like array. That will enable us to use ringbuffers more e.g.
lastN
can actually return a ringbuffer instead of array.The text was updated successfully, but these errors were encountered: