struct type 'a t = 'a counter let create ?n () = create ?n 0 ident ( + ) let add = add let tick accu x = add accu x 1 let stream = stream let of_stream e = let c = create () in Stream.iter ~f:(tick c) e ; c end