Functional implemenation of event streams