unionWith package:reactive-banana

Merge two event streams of the same type. The function argument specifies how event values are to be combined in case of a simultaneous occurrence. The semantics are
unionWith f ((timex,x):xs) ((timey,y):ys)
| timex <  timey = (timex,x)     : unionWith f xs ((timey,y):ys)
| timex >  timey = (timey,y)     : unionWith f ((timex,x):xs) ys
| timex == timey = (timex,f x y) : unionWith f xs ys