Generalize Pipelines to Workflows.

I’ve tried to make this PR as small as possible – containing only the changes necessary for the Workflow conversion. It’s still pretty big.
This anonFunDecl, with these arguments, shows up at least couple of times, unsurprisingly. Maybe we need some combinators to generate the common JS patterns (map, reduce, maybe others?)