let of_function ?name f =
let q = Queue.create () in
make ?name ~feed:(Queue.enqueue q) ()
~next:(fun stopped ->
match Queue.dequeue q with
| Some o -> `output (f o)
| None -> if stopped then `end_of_stream else `not_ready)