streamly-core-0.1.0: Streaming, parsers, arrays and more
Copyright(c) 2021 Composewell Technologies
LicenseBSD-3-Clause
Maintainerstreamly@composewell.com
Stabilityexperimental
PortabilityGHC
Safe HaskellSafe-Inferred
LanguageHaskell2010

Streamly.Internal.Data.Ring

Description

 
Synopsis

Documentation

data Ring a Source #

Constructors

Ring 

Fields

Generation

createRing :: MonadIO m => Int -> m (Ring a) Source #

writeLastN :: MonadIO m => Int -> Fold m a (Ring a) Source #

Modification

seek :: MonadIO m => Int -> Ring a -> m (Ring a) Source #

Move the ring head clockwise (+ve adj) or counter clockwise (-ve adj) by the given amount.

Conversion

toMutArray :: MonadIO m => Int -> Int -> Ring a -> m (MutArray a) Source #

toMutArray rignHeadAdjustment lengthToRead ring. Convert the ring into a boxed mutable array. Note that the returned MutArray may share the same underlying memory as the Ring.

toStreamWith :: Int -> Ring a -> Stream m a Source #

Seek by n and then read the entire ring. Use take on the stream to restrict the reads.