tagshare-0.0: TagShare - explicit sharing with tags

Safe HaskellSafe-Infered




A monad for binding values to tags to ensure sharing, with the added twist that the value can be polymorphic and each monomorphic instance is bound separately.


Dynamic map

data DynMap tag Source

A dynamic map with type safe insertion and lookup.


Show tag => Show (DynMap tag) 

dynInsert :: (Typeable a, Ord tag) => tag -> a -> DynMap tag -> DynMap tagSource

dynLookup :: (Typeable a, Ord tag) => tag -> DynMap tag -> Maybe aSource

Sharing monad

type Sharing tag a = State (DynMap tag) aSource

A sharing monad with a function that binds a tag to a value.

share :: (Typeable a, Ord tag) => tag -> Sharing tag a -> Sharing tag aSource