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

Safe HaskellNone
LanguageHaskell2010

Data.Rsv.RList

Contents

Description

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

This module implements a list, where each insert is appended to its tail.

Synopsis

Documentation

data RList a Source

empty :: RList a Source

An empty RList.

Read operations

toList :: RList a -> [a] Source

Write operations

insert :: a -> RList a -> (Delete a, RList a) Source

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

type Delete a = RList a -> (Maybe a, RList a) Source

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

Write operations in StateT

sInsert :: Monad m => a -> StateT (RList a) m (SDelete a m) Source

Same as insert except in the StateT monad

type SDelete a m = StateT (RList a) m (Maybe a) Source

Same as Delete except in the StateT monad