compact-list-0.1.0: An append only list in a compact region

Copyright(c) 2018 Composewell Technologies
(c) 2001-14 GHC Project
LicenseBSD3
Maintainerharendra.kumar@gmail.com
Stabilityexperimental
PortabilityGHC
Safe HaskellNone
LanguageHaskell2010

Data.CompactList

Description

If you hold on to a large data structure in garbage collected (GC) memory for relatively longer times it puts undue pressure on GC, unnecessarily increasing the work done by GC and also increasing the duration of GC pauses. A CompactList allows you to keep a large list in a Compact Region not touched by GC, thus avoiding any GC overhead. This is essentially like a convenient in-memory append only file where you can write a list of Haskell values without having to marshall or serialize them.

A CompactList is like a thread safe IORef to a list in compact region.

Synopsis

Documentation

data CompactList a Source #

A list with values of type a living in a compact (non-GC) region.

newCompactList :: [a] -> IO (CompactList a) Source #

Make a new compact list from a list.

consCompactList :: CompactList a -> a -> IO () Source #

Add an element at the head of the compact list. The modification is thread safe.

readCompactList :: CompactList a -> IO [a] Source #

Retrieve the compact list from the compact region.