cqrs-0.2.1: Command-Query Responsibility Segregation



Run transactions against event stores.



data TransactionT e m a Source

Transaction monad transformer.

getAggregateRoot :: (Default a, Event e a, Typeable a, Typeable e, Aggregate a) => GUID a -> TransactionT e IO (AggregateRef a e, a)Source

Get aggregate root.

publishEvent :: (MonadIO m, Event e a) => AggregateRef a e -> e -> TransactionT e m ()Source

Publish event for an aggregate root.

retrieveEvents :: forall e a. Event e a => Int -> Int -> (e -> IO ()) -> TransactionT e IO ()Source

Retrieve a range of events, invoking a callback function for each event. For example,

 retrieveEvents 10 20 $ \e -> do
   putStrLn $ "Event: " ++ show e

would print all events between logical time 20 (inclusive) and logical time 30 (not inclusive). Logical time starts at 1. It is NOT an error to provide bounds for which there are no events.

runTransactionT :: (Typeable a, Typeable e, Event e a, Default a, Aggregate a) => EventStore -> TransactionT e IO c -> IO cSource

Run transaction against an event store.