Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
Control.Monad.TagShare
Contents
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
- data DynMap tag
- dynEmpty :: DynMap tag
- dynInsert :: (Typeable a, Ord tag) => tag -> a -> DynMap tag -> DynMap tag
- dynLookup :: (Typeable a, Ord tag) => tag -> DynMap tag -> Maybe a
- type Sharing tag a = State (DynMap tag) a
- runSharing :: Sharing tag a -> a
- share :: (Typeable a, Ord tag) => tag -> Sharing tag a -> Sharing tag a
Dynamic map
A dynamic map with type safe insertion and lookup.
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 #