tagshare-0.0: TagShare - explicit sharing with tags
Safe HaskellSafe-Inferred
LanguageHaskell98

Control.Monad.TagShare

Description

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.

Synopsis

Dynamic map

data DynMap tag Source #

A dynamic map with type safe insertion and lookup.

Instances

Instances details
Show tag => Show (DynMap tag) Source # 
Instance details

Defined in Control.Monad.TagShare

Methods

showsPrec :: Int -> DynMap tag -> ShowS Source #

show :: DynMap tag -> String Source #

showList :: [DynMap tag] -> ShowS Source #

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

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

Sharing monad

type Sharing tag a = State (DynMap tag) a Source #

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

runSharing :: Sharing tag a -> a Source #

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