re-wrote minor part of CodeGenerator to work with pipelines
reverted the second pipeline to the much smaller nested calls

- interesting (but ugly) how you need to do all sorts of higher-order
  function constructions ("bind(bind...", "curry2(apply...")
- to capture various inputs and shuffle them into the right places for the
  consuming functions