cqrs-0.2.0: src/Data/CQRS/Event.hs
-- | Event type class. All events that can be applied to aggregate roots
-- are required have an instance for this class.
module Data.CQRS.Event
( Event(..)
) where
import Data.ByteString (ByteString)
-- | Event class for applying events to aggregates.
class Event e a | e -> a where
-- | Apply an event to the aggregate and return the updated aggregate.
applyEvent :: e -> a -> a
-- | Encode event into a strict ByteString.
encodeEvent :: e -> ByteString
-- | 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.
decodeEvent :: ByteString -> e