| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Free.Agent.Pipeline
Description
Synopsis
- data Pipeline a b where
- runPipeline :: Pipeline a b -> [a] -> [b]
- pipelineShard :: Pipeline a b -> Poles (Body (,) [a] (K IO)) [a] [b]
- filterP :: (a -> Bool) -> Pipeline a a
- mapP :: (a -> b) -> Pipeline a b
- routeP :: (a -> [b]) -> Pipeline a b
- routeTo :: Name -> Pipeline (Post Text) (Post Text)
- routeBy :: (Post Text -> [Name]) -> Pipeline (Post Text) (Post Text)
- broadcast :: [Name] -> Pipeline (Post Text) (Post Text)
- forName :: Name -> Pipeline (Post Text) (Post Text)
- fromName :: Name -> Pipeline (Post Text) (Post Text)
Documentation
data Pipeline a b where Source #
A pipeline stage or composition of stages.
Constructors
| Filter :: forall a. (a -> Bool) -> Pipeline a a | Keep only inputs that satisfy the predicate. |
| Map :: forall a b. (a -> b) -> Pipeline a b | Transform each input. |
| Route :: forall a b. (a -> [b]) -> Pipeline a b | Expand each input into zero or more outputs. |
| Compose :: forall b1 b a. Pipeline b1 b -> Pipeline a b1 -> Pipeline a b | Sequence two pipelines. |
runPipeline :: Pipeline a b -> [a] -> [b] Source #
Fold a pipeline into a pure list function.
pipelineShard :: Pipeline a b -> Poles (Body (,) [a] (K IO)) [a] [b] Source #
Run a pipeline as a closed stateful shard.
The state holds the pending input batch. Commit replaces it; emit applies the pipeline and clears the buffer.
routeBy :: (Post Text -> [Name]) -> Pipeline (Post Text) (Post Text) Source #
Route posts using a function from the post to a recipient list.
broadcast :: [Name] -> Pipeline (Post Text) (Post Text) Source #
Broadcast every post to a list of recipients.