Expressive middleware for stream programming using generators