btree-0.3.1: B-Tree on Unmanaged Heap

Safe HaskellNone
LanguageHaskell2010

BTree.Store

Contents

Synopsis

Documentation

data BTree k v Source #

Instances
Storable (BTree k v) Source # 
Instance details

Defined in BTree.Store

Methods

sizeOf :: BTree k v -> Int #

alignment :: BTree k v -> Int #

peekElemOff :: Ptr (BTree k v) -> Int -> IO (BTree k v) #

pokeElemOff :: Ptr (BTree k v) -> Int -> BTree k v -> IO () #

peekByteOff :: Ptr b -> Int -> IO (BTree k v) #

pokeByteOff :: Ptr b -> Int -> BTree k v -> IO () #

peek :: Ptr (BTree k v) -> IO (BTree k v) #

poke :: Ptr (BTree k v) -> BTree k v -> IO () #

(Storable k, Deinitialize v) => Deinitialize (BTree k v) Source # 
Instance details

Defined in BTree.Store

Methods

deinitialize :: Ptr (BTree k v) -> IO () Source #

deinitializeElemOff :: Ptr (BTree k v) -> Int -> IO () Source #

deinitializeElems :: Ptr (BTree k v) -> Int -> IO () Source #

Initialize (BTree k v) Source # 
Instance details

Defined in BTree.Store

Methods

initialize :: Ptr (BTree k v) -> IO () Source #

initializeElemOff :: Ptr (BTree k v) -> Int -> IO () Source #

initializeElems :: Ptr (BTree k v) -> Int -> IO () Source #

class Storable a => Initialize a where Source #

Minimal complete definition

initialize

Methods

initialize :: Ptr a -> IO () Source #

Initialize the memory at a pointer. An implementation of this function may do nothing, or if the data contains more pointers, initialize may allocate additional memory.

initializeElemOff :: Ptr a -> Int -> IO () Source #

Can be overridden for efficiency

initializeElems :: Ptr a -> Int -> IO () Source #

Initialize a pointer representing an array with a given number of elements. This has a default implementation but may be overriden for efficency.

Instances
Initialize Char Source # 
Instance details

Defined in BTree.Store

Initialize Int Source # 
Instance details

Defined in BTree.Store

Initialize Int64 Source # 
Instance details

Defined in BTree.Store

Initialize Word Source # 
Instance details

Defined in BTree.Store

Initialize Word8 Source # 
Instance details

Defined in BTree.Store

Initialize Word16 Source # 
Instance details

Defined in BTree.Store

Initialize Word32 Source # 
Instance details

Defined in BTree.Store

Initialize Word64 Source # 
Instance details

Defined in BTree.Store

Storable a => Initialize (ArrayList a) Source # 
Instance details

Defined in ArrayList

Initialize (BTree k v) Source # 
Instance details

Defined in BTree.Store

Methods

initialize :: Ptr (BTree k v) -> IO () Source #

initializeElemOff :: Ptr (BTree k v) -> Int -> IO () Source #

initializeElems :: Ptr (BTree k v) -> Int -> IO () Source #

class Storable a => Deinitialize a where Source #

Minimal complete definition

deinitialize

Methods

deinitialize :: Ptr a -> IO () Source #

deinitializeElemOff :: Ptr a -> Int -> IO () Source #

Can be overridden for efficiency

deinitializeElems :: Ptr a -> Int -> IO () Source #

Free any memory pointed to by elements of the array. This has a default implementation but may be overriden for efficency.

Instances
Deinitialize Char Source # 
Instance details

Defined in BTree.Store

Deinitialize Int Source # 
Instance details

Defined in BTree.Store

Deinitialize Int64 Source # 
Instance details

Defined in BTree.Store

Deinitialize Word Source # 
Instance details

Defined in BTree.Store

Deinitialize Word8 Source # 
Instance details

Defined in BTree.Store

Deinitialize Word16 Source # 
Instance details

Defined in BTree.Store

Deinitialize Word32 Source # 
Instance details

Defined in BTree.Store

Deinitialize Word64 Source # 
Instance details

Defined in BTree.Store

(Storable k, Deinitialize v) => Deinitialize (BTree k v) Source # 
Instance details

Defined in BTree.Store

Methods

deinitialize :: Ptr (BTree k v) -> IO () Source #

deinitializeElemOff :: Ptr (BTree k v) -> Int -> IO () Source #

deinitializeElems :: Ptr (BTree k v) -> Int -> IO () Source #

data Decision Source #

Constructors

Keep 
Delete 

new :: forall k v. (Storable k, Storable v) => IO (BTree k v) Source #

free :: forall k v. (Storable k, Deinitialize v) => BTree k v -> IO () Source #

Release all memory allocated by the b-tree. Do not attempt to use the b-tree after calling this.

with :: (Storable k, Initialize v, Deinitialize v) => (BTree k v -> IO (a, BTree k v)) -> IO a Source #

with_ :: (Storable k, Initialize v, Deinitialize v) => (BTree k v -> IO (BTree k v)) -> IO () Source #

lookup :: forall k v. (Ord k, Storable k, Storable v) => BTree k v -> k -> IO (Maybe v) Source #

insert :: (Ord k, Storable k, Initialize v) => BTree k v -> k -> v -> IO (BTree k v) Source #

modifyWithM_ Source #

Arguments

:: (Ord k, Storable k, Initialize v) 
=> BTree k v 
-> k 
-> (v -> IO v)

value modification, happens for newly inserted elements and for previously existing elements

-> IO (BTree k v) 

modifyWithM Source #

Arguments

:: (Ord k, Storable k, Initialize v) 
=> BTree k v 
-> k 
-> (v -> IO (a, v))

value modification, happens for newly inserted elements and for previously existing elements

-> IO (a, BTree k v) 

modifyWithPtr Source #

Arguments

:: (Ord k, Storable k, Initialize v) 
=> BTree k v 
-> k 
-> Either r (Ptr v -> Int -> IO r)

modifications to newly inserted value

-> (Ptr v -> Int -> IO (r, Decision))

modification to value if key is found

-> IO (r, BTree k v) 

foldrWithKey :: forall k v b. (Ord k, Storable k, Storable v) => (k -> v -> b -> IO b) -> b -> BTree k v -> IO b Source #

toAscList :: forall k v. (Ord k, Storable k, Storable v) => BTree k v -> IO [(k, v)] Source #

This is provided for convenience but is not something typically useful in production code.

Weird Operations

index :: forall k v. (Storable k, Storable v) => BTree k v -> (Int -> Int) -> Int -> IO v Source #

indexNode :: forall k v. (Storable k, Storable v) => BTree k v -> (Int -> Int) -> Int -> IO (Ptr v, Int) Source #

Force inlining

inlineModifyWithPtr Source #

Arguments

:: (Ord k, Storable k, Initialize v) 
=> BTree k v 
-> k 
-> Either r (Ptr v -> Int -> IO r)

modifications to newly inserted value

-> (Ptr v -> Int -> IO (r, Decision))

modification to value if key is found

-> IO (r, BTree k v) 

inlineModifyWithM Source #

Arguments

:: (Ord k, Storable k, Initialize v) 
=> BTree k v 
-> k 
-> (v -> IO (a, v))

value modification, happens for newly inserted elements and for previously existing elements

-> IO (a, BTree k v)