cqrs-0.8.0: Command-Query Responsibility Segregation

Data.CQRS.Aggregate

Description

Aggregate type class.

Synopsis

Documentation

class Aggregate a whereSource

Type class for aggregates.

Methods

encodeAggregate :: a -> ByteStringSource

Encode aggregate into a ByteString representation. The representation should contain some metadata (a UUID for example) which can be used to check reliably whether the encoded representation is valid upon decoding. This can be used if the actual aggregate structure changes.

decodeAggregate :: ByteString -> Maybe aSource

Decode ByteString to aggregate state. If decoding is not possible should return Nothing.