dynamic-state-0.1.0.5: Optionally serializable dynamic state keyed by type

LicenseGPL2
Maintainerzcarterc@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010
Extensions
  • Cpp
  • ScopedTypeVariables
  • DeriveDataTypeable
  • ExistentialQuantification
  • TupleSections
  • ExplicitForAll

Data.DynamicState.Serializable

Description

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.

Synopsis

Documentation

data Dynamic Source

A Dynamic value, potentially stored serialized

Constructors

forall a . (Typeable a, Binary a) => Dynamic !a 
Serial !ByteString 

Instances

fromDynamic :: forall a. (Typeable a, Binary a) => Dynamic -> Maybe (a, Bool) Source

Try to extract a value from the Dynamic, returning True if it was decoded from a Serial

newtype DynamicState Source

An extensible record, indexed by type, using state to cache deserializtion

getDyn :: forall m a. (Typeable a, Binary a, Monad m) => m DynamicState -> (DynamicState -> m ()) -> m (Maybe a) Source

Get a value, inside a State-like monad specified by the first two functions

putDyn :: forall m a. (Typeable a, Binary a, Monad m) => m DynamicState -> (DynamicState -> m ()) -> a -> m () Source

Set a value, inside a State-like monad specified by the first two functions