Event type class. All events that can be applied to aggregate roots are required have an instance for this class.
- class Event e a | e -> a where
- applyEvent :: e -> a -> a
- encodeEvent :: e -> ByteString
- decodeEvent :: ByteString -> e
Documentation
class Event e a | e -> a whereSource
Event class for applying events to aggregates.
applyEvent :: e -> a -> aSource
Apply an event to the aggregate and return the updated aggregate.
encodeEvent :: e -> ByteStringSource
Encode event into a strict ByteString.
decodeEvent :: ByteString -> eSource
Decode event from a strict ByteString. To avoid corrupt event stores, any events that have ever been stored {b must} be decodable for all time.