Mikan
Safe HaskellNone
LanguageHaskell2010

Mikan.Utils.CompactRegion

Description

Functions for working with GHC's compact regions.

This module is intended to be imported qualified as:

import Mikan.Utils.CompactRegion qualified as Compact
Synopsis

Documentation

data Compact Source #

A handle to a compact region.

Instances

Instances details
NFData Compact Source # 
Instance details

Defined in Mikan.Utils.CompactRegion

Methods

rnf :: Compact -> () #

new :: Word -> IO Compact Source #

Create a new compact region with given initial block size.

add :: Compact -> a -> IO a Source #

Deeply evaluate a value and add it to a compact region.

Warning: This function is NOT thread-safe. Users are responsible for enforcing mutual exclusion.

compact :: Word -> a -> a Source #

Deeply evaluate a value and place it in a fresh compact region with a given initial block size.

If the structure contains any internal sharing, the shared data will be duplicated during compaction. Moreover, compact will not terminate if the value contains any cycles.

The value must not contain any functions or data with mutable pointers; if it does, compact will raise an exception.