schedule-0.0: Schedule sub-computations to run later, in a pure way

Safe HaskellNone
LanguageHaskell2010

Data.Rsv.RMMap

Contents

Description

See Data.Rsv for an overview of what "reservation" data structures are.

This module implements a multi-map, where each insert is indexed by a key, and many independent inserts may be performed on the same key.

Synopsis

Documentation

data RMMap k a Source

empty :: RMMap k a Source

An empty RMMap.

Read operations

(!) :: Ord k => RMMap k a -> k -> [a] Source

Write operations

insert :: Ord k => k -> a -> RMMap k a -> (Delete k a, RMMap k a) Source

Add an item to the list, returning a handle to remove it with. The same item may be added twice, in which case it will occupy multiple positions in the map, and the handles distinguish these occurences.

type Delete k a = RMMap k a -> (Maybe a, RMMap k a) Source

A map-transition that removes and retrieves the earlier-added item. If the item was already removed, Nothing is returned instead.

deleteKey :: Ord k => k -> RMMap k a -> RMMap k a Source

Write operations in StateT

sInsert :: (Ord k, Monad m) => k -> a -> StateT (RMMap k a) m (SDelete k a m) Source

Same as insert except in the StateT monad

type SDelete k a m = StateT (RMMap k a) m (Maybe a) Source

Same as Delete except in the StateT monad

sDeleteKey :: (Ord k, Monad m) => k -> StateT (RMMap k a) m () Source

Same as deleteKey except in the StateT monad