Currently, the close
function return the close
type (as a post-condition). So, statically it assumes that your computation close properly the file descriptor. Afterthat, you can compute a specialized version of a computation which terminates by the close
post-condition.
However, if you want to compute any computation (like what run
does), you can result with any state. Sage.Refl
helps you to introspect the type and prove the equality with Sage.close
(note that a PR is pending into ocaml/ocaml
to add the Refl
constructor into the standard library).
About multiple opened files, it’s currently not possible to do that but it’s probably possible to solve this issue with a tuple of opened file-descriptors.