Process

Project Status: beta, actively developed

 

Process is a fun library for easing decomposition algorithms to several processes, which transmit intermediate data via Unix-like pipes. You can write, for example: “runP$ producer |> transformer1 |> transformer2 |> printer”, where each “sub-process” in transporter is just a function started with forkIO/forkOS with one additional parameter – “pipe”. This pipe can be “read” with receiveP function to get data from previous process in transporter, and “written” with sendP to send data to next process. Pipe can be made one-element (MVar) with “|>” operator, or multi-element (Chan) with “|>>>”. Also supported “back pipe” which can be used to return to previous process acknowledgements or, for example, borrowed buffers. Process or entire transporter can also be run asynchronously and then communicated via returned pipe: “pipe <- runAsyncP$ transformer1 |> transformer2”. Moreover, process/transporter can be run against 4 functions, which will be used for all it’s piping operations, what opens whole range of possibilities to create more complex process-control structures.

 

This lead to situation when Process, while more a syntactic sugar for well-known forkOS/MVar/Chan ingredients, than a “real” library, has become a very useful tool for assembling complex algorithms from simple pieces, which somehow transforms data. This is like situation of Unix popularity because it provides the same instruments for assembling together separate simple programs, but in this case you don’t transmit plain byte stream, but typed data.

 

Download page: http://freearc.narod.ru