Use >->
to connect Producer
s, Consumer
s and Pipe
s to compose larger Pipe
functions.
printNaturals :: MonadIO m => Effect m ()
printNaturals = naturalsUntil 10 >-> intToStr >-> fancyPrint
Producer
, Consumer
, Pipe
, and Effect
types are all defined in terms of the general Proxy
type. Therefore >->
can be used for a variety of purposes. Types defined by the left argument must match the type consumed by the right argument:
(>->) :: Monad m => Producer b m r -> Consumer b m r -> Effect m r
(>->) :: Monad m => Producer b m r -> Pipe b c m r -> Producer c m r
(>->) :: Monad m => Pipe a b m r -> Consumer b m r -> Consumer a m r
(>->) :: Monad m => Pipe a b m r -> Pipe b c m r -> Pipe a c m r