let sf ?(cout=stderr) msg f a = fprintf cout "%s... %!" msg; let b = f a in fprintf cout "finished\n%!"; b