-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Optionally serializable dynamic state keyed by type
--   
--   Optionally serializable dynamic state keyed by type
@package dynamic-state
@version 0.1.1.0


-- | This module is HashMap ConcreteTypeRep Dynamic with a twist. The
--   Dynamic used can also be ByteString, to make repeated reserialization
--   cheap. A user-provided State-like is used to store this.
module Data.DynamicState.Serializable

-- | An extensible record, indexed by type, using state to cache
--   deserializtion
newtype DynamicState
DynamicState :: HashMap ConcreteTypeRep Dynamic -> DynamicState
unDynamicState :: DynamicState -> HashMap ConcreteTypeRep Dynamic

-- | Get a value, inside a State-like monad specified by the first two
--   functions
getDyn :: (Typeable a, Binary a, Monad m) => m DynamicState -> (DynamicState -> m ()) -> m (Maybe a)

-- | Set a value, inside a State-like monad specified by the first two
--   functions
putDyn :: (Typeable a, Binary a, Monad m) => m DynamicState -> (DynamicState -> m ()) -> a -> m ()
instance Typeable DynamicState
instance Binary DynamicState
instance Monoid DynamicState
instance Binary Dynamic


-- | This module implements a simple HashMap ConcreteTypeRep Dynamic
module Data.DynamicState

-- | An extensible record, indexed by type
newtype DynamicState
DynamicState :: HashMap ConcreteTypeRep Dynamic -> DynamicState
unDynamicState :: DynamicState -> HashMap ConcreteTypeRep Dynamic
getDyn :: Typeable a => DynamicState -> Maybe a
setDyn :: Typeable a => DynamicState -> a -> DynamicState

-- | Lens with default value
_dyn :: (Typeable a, Functor f) => a -> (a -> f a) -> DynamicState -> f DynamicState
instance Typeable DynamicState
instance Monoid DynamicState
