Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Type for "pipes", having multiple writers and readers.
Each element (of type a
) written to the pipe is "presented" to each reader (continuation) (of type a -> r
).
Elements and readers can be adder in any order. When a new element is added, it is presented to the existing readers. When a new reader is adder, it is presented with the existing elements.
This type is used internally in the implementation of EarleyM
, but it may be more widely useful.
Documentation
write :: a -> Pipe a r -> (Pipe a r, [r]) Source
Write an element to a pipe, returning the new pipe and presentation results.
read :: (a -> r) -> Pipe a r -> (Pipe a r, [r]) Source
Attach a reader to a pipe, returning the new pipe and presentation results.
firstWrite :: a -> Pipe a r Source
Create a pipe from a single element.