# Nottingham FP Lab Blog

## Pipes & Switches

by Thorsten on March 20, 2006.
Tagged as: Lunches.

Recently I introduced a functional model of Stream IO – this can be generalized to allow any type of input and output and we can define a pipe operator (>>>>) to combine processes. The resulting type of traces (see Traces.hs for the Haskell code) is at the same time a monad (in the return type) and an arrow over coproducts in the input and output types. I consider this as a promising formalism to integrate data-flow (pipes) and control-flow (switches). However, my attempt of a law relating pipes and switches was doomed as it was quickly noticed by the attentive FP lunch audience. I believe I now know how to fix it but this is for another time (I should actually prove my laws and not just type-check them…

This is inspired Henrik’s work on Yampa (which introduces the notion of a switch), Varmo and Tarmo’s paper on dataflow programmingand is based on discussions with Varmo and Tarmo on a cold February day in Tartu. A good reference for arrows is Ross Paterson’s paper. I am using coproduct arrows here, which correspond to Arrows without first but with left (as in ArrowChoice).