Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- type Pipe action item1 item2 = Vendor (Next item1) (Next item2) action
- type PipePlus up action item1 item2 = TerminableStream item1 up => Vendor up (Next item2) action
- cons :: forall item action up. Job up action item -> PipePlus up action item item
- map :: forall item1 item2 action up. (item1 -> Job up action item2) -> PipePlus up action item1 item2
- concat :: forall item action up. PipePlus up action [item] item
- takeWhile :: forall item action up. (item -> Job up action Bool) -> PipePlus up action item item
- dropWhile :: forall item action up. (item -> Job up action Bool) -> PipePlus up action item item
- group :: forall up item action. Eq item => PipePlus up action item (Positive, item)
- intersperse :: forall item action up. Job up action item -> PipePlus up action item item
- beforeEach :: forall item action up. Job up action item -> PipePlus up action item item
- id :: forall up item action. PipePlus up action item item
- concatMapJob :: forall item1 item2 action up. (item1 -> Job up action [item2]) -> PipePlus up action item1 item2
- concatMapProducer :: forall item1 item2 action. (item1 -> Producer action item2) -> Pipe action item1 item2
Types
See Next.Pipe.Type
type PipePlus up action item1 item2 = TerminableStream item1 up => Vendor up (Next item2) action Source #
Like Pipe
, but with a more general upstream interface
which can be anything in the TerminableStream
class
This type is like Pipe
except that it has an extra type parameter
representing the upstream interface, hence its name is "pipe plus".
Examples
:: forall item action up. Job up action item | This job produces an item to add to the front of the list |
-> PipePlus up action item item |
Add one item to the beginning of a stream
:: forall item1 item2 action up. (item1 -> Job up action item2) | For each input item, this job produces an output item |
-> PipePlus up action item1 item2 |
Apply a function to each item in the stream
:: forall item action up. (item -> Job up action Bool) | True if this is the sort of thing we'd like to keep |
-> PipePlus up action item item |
Yields the longest prefix matching the predicate and discards the rest
:: forall item action up. (item -> Job up action Bool) | True if this is the sort of thing we'd like to get rid of |
-> PipePlus up action item item |
Discards the longest prefix matching the predicate and yields the rest
group :: forall up item action. Eq item => PipePlus up action item (Positive, item) Source #
Removes consecutive duplicate items, and yields each item along with the size of the repetition
For example, "Hrmm..."
groups into
[(1, 'H'), (1, 'r'), (2, 'm'), (3, '.')]
:: forall item action up. Job up action item | This job generates items that will be inserted in between the items of the original list |
-> PipePlus up action item item |
Add an item between each pair of items of a stream
The length of the stream is modified as \case{ 0 -> 0; n -> (2 * n) - 1 }
.
:: forall item action up. Job up action item | This job generates items that will be inserted before each of the items of the original list |
-> PipePlus up action item item |
Add an item before each item in a stream
The length of the stream is doubled.
:: forall item1 item2 action up. (item1 -> Job up action [item2]) | For each input item, this job produces any number of output items |
-> PipePlus up action item1 item2 |
Applies the function to each result obtained from upstream, and yields each result from the list to the downstream
:: forall item1 item2 action. (item1 -> Producer action item2) | For each item from the input list, this vendor generates any number of actions to yield in the resulting list |
-> Pipe action item1 item2 |
Like concatMapJob
, but the function gives a Producer
instead of a Job