happstack-data-0.2.1: Happstack data manipulation librariesSource codeContentsIndex
Happstack.Data.Serialize
Synopsis
class (Typeable a, Version a) => Serialize a where
getCopy :: Contained (Get a)
putCopy :: a -> Contained Put
class Version a where
mode :: Mode a
class Migrate a b where
migrate :: a -> b
data Mode a
= Primitive
| Versioned (VersionId a) (Maybe (Previous a))
data Contained a
contain :: a -> Contained a
extension :: forall a b. (Serialize b, Migrate b a) => VersionId a -> Proxy b -> Mode a
safeGet :: forall a. Serialize a => Get a
safePut :: forall a. Serialize a => a -> Put
serialize :: Serialize a => a -> ByteString
deserialize :: Serialize a => ByteString -> (a, ByteString)
collectVersions :: forall a. (Typeable a, Version a) => Proxy a -> [ByteString]
data Object
mkObject :: Serialize a => a -> Object
deserializeObject :: ByteString -> (Object, ByteString)
parseObject :: Serialize a => Object -> a
module Happstack.Data.Proxy
Documentation
class (Typeable a, Version a) => Serialize a whereSource
Methods
getCopy :: Contained (Get a)Source
putCopy :: a -> Contained PutSource
show/hide Instances
class Version a whereSource
Methods
mode :: Mode aSource
show/hide Instances
class Migrate a b whereSource
Migrate instances are needed to allow upgrades of MACID state. It should be declared as instance Migrate Old New where migrate = transition_function
Methods
migrate :: a -> bSource
data Mode a Source
Constructors
PrimitiveData layout won't change. Used for types like Int and Char.
Versioned (VersionId a) (Maybe (Previous a))
data Contained a Source
contain :: a -> Contained aSource
Lifts the provided value into Contained
extension :: forall a b. (Serialize b, Migrate b a) => VersionId a -> Proxy b -> Mode aSource
safeGet :: forall a. Serialize a => Get aSource
Equivalent of Data.Binary.get for instances of Serialize Takes into account versioning of types.
safePut :: forall a. Serialize a => a -> PutSource
Equivalent of Data.Binary.put for instances of Serialize. Takes into account versioning of types.
serialize :: Serialize a => a -> ByteStringSource
Pure version of safePut. Serializes to a ByteString
deserialize :: Serialize a => ByteString -> (a, ByteString)Source
Pure version of safeGet. Parses a ByteString into the expected type and a remainder.
collectVersions :: forall a. (Typeable a, Version a) => Proxy a -> [ByteString]Source
Version lookups
data Object Source
show/hide Instances
mkObject :: Serialize a => a -> ObjectSource
Serializes data and stores it along with its type name in an Object
deserializeObject :: ByteString -> (Object, ByteString)Source
deserialize specialized to Objects
parseObject :: Serialize a => Object -> aSource
Attempts to convert an Object back into its base type. If the conversion fails error will be called.
module Happstack.Data.Proxy
Produced by Haddock version 2.4.2