Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- type Transformer inputEvent eventId event = inputEvent -> Transform eventId event ()
- data TransformedStream m identifier metadata event
- transformStream :: Stream m stream => Transformer (Either (EventIdentifier stream, String) (EventWithContext' stream)) identifier (EventWithContext identifier metadata event) -> (identifier -> m (EventIdentifier stream)) -> stream -> TransformedStream m identifier metadata event
- data TransformedStreamFamily m streamId eventId metadata event
- transformStreamFamily :: forall m streamId eventId metadata event streamFamily. (Hashable (StreamIdentifier streamFamily), Ord (StreamIdentifier streamFamily), Stream m (StreamType streamFamily), StreamFamily m streamFamily) => Transformer (Either (EventIdentifier (StreamType streamFamily), String) (EventWithContext' (StreamType streamFamily))) eventId (EventWithContext eventId metadata event) -> (StreamIdentifier streamFamily -> m streamId) -> (streamId -> m (StreamIdentifier streamFamily)) -> (EventIdentifier (StreamType streamFamily) -> m eventId) -> (eventId -> m (EventIdentifier (StreamType streamFamily))) -> streamFamily -> TransformedStreamFamily m streamId eventId metadata event
- type Transform eventId event = Free (TransformF eventId event)
- pushEvent :: event -> Transform eventId event ()
- mergeEvents :: ([event] -> (a, [event])) -> Transform eventId event a
- flushEvents :: Transform eventId event ()
- failTransformer :: eventId -> String -> Transform eventId event ()
Transformed stream
type Transformer inputEvent eventId event = inputEvent -> Transform eventId event () Source #
data TransformedStream m identifier metadata event Source #
Instances
transformStream :: Stream m stream => Transformer (Either (EventIdentifier stream, String) (EventWithContext' stream)) identifier (EventWithContext identifier metadata event) -> (identifier -> m (EventIdentifier stream)) -> stream -> TransformedStream m identifier metadata event Source #
Transformed stream family
data TransformedStreamFamily m streamId eventId metadata event Source #
Instances
transformStreamFamily :: forall m streamId eventId metadata event streamFamily. (Hashable (StreamIdentifier streamFamily), Ord (StreamIdentifier streamFamily), Stream m (StreamType streamFamily), StreamFamily m streamFamily) => Transformer (Either (EventIdentifier (StreamType streamFamily), String) (EventWithContext' (StreamType streamFamily))) eventId (EventWithContext eventId metadata event) -> (StreamIdentifier streamFamily -> m streamId) -> (streamId -> m (StreamIdentifier streamFamily)) -> (EventIdentifier (StreamType streamFamily) -> m eventId) -> (eventId -> m (EventIdentifier (StreamType streamFamily))) -> streamFamily -> TransformedStreamFamily m streamId eventId metadata event Source #
Transform monad
type Transform eventId event = Free (TransformF eventId event) Source #
Monad in which you can push, merge and flush events.
mergeEvents :: ([event] -> (a, [event])) -> Transform eventId event a Source #
Apply a function to the queue of event returning a value and a new queue, sets the queue to the new one and return the value.
The intent is to allow a new event to be merged in a previous one if possible to make the new event stream more compact.
flushEvents :: Transform eventId event () Source #
Flush the queue so it can be processed downstream, e.g. sent to a message broker.
Flushing may also occur automatically.
failTransformer :: eventId -> String -> Transform eventId event () Source #
Flush the events and push an error downstream.