netwire-4.0.1: Flexible wire arrows for FRP

Copyright(c) 2012 Ertugrul Soeylemez
LicenseBSD3
MaintainerErtugrul Soeylemez <es@ertes.de>
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Wire.TimedMap

Contents

Description

Timed maps for efficient cleanups in the context wires.

Synopsis

Timed maps

data TimedMap t k a Source

A timed map is a map with an additional index based on time.

Instances

Typeable (* -> * -> * -> *) TimedMap 
(Data t, Data k, Data a, Ord t, Ord k) => Data (TimedMap t k a) 
(Show t, Show k, Show a) => Show (TimedMap t k a) 

Queries

findWithDefault :: Ord k => (a, t) -> k -> TimedMap t k a -> (a, t) Source

Like lookup, but with a default value, if the key is not in the map.

lookup :: Ord k => k -> TimedMap t k a -> Maybe (a, t) Source

Look up the given key in the timed map.

Construction

empty :: TimedMap t k a Source

Empty timed map.

Insertion

insert :: (Ord k, Ord t) => t -> k -> a -> TimedMap t k a -> TimedMap t k a Source

Insert into the timed map.

Deletion

cleanup :: (Ord k, Ord t) => t -> TimedMap t k a -> TimedMap t k a Source

Remove all elements older than the given time.

cut :: (Ord k, Ord t) => Int -> TimedMap t k a -> TimedMap t k a Source

Remove all but the given number of latest elements.

delete :: (Ord k, Ord t) => k -> TimedMap t k a -> TimedMap t k a Source

Deletes the given key from the timed map.