asynchronous - force exit of an ocaml async program -


i'd implement following behavior:

let x =      try         do_some_computation ()         | some_error -> exit_my_program () in ... 

of course, raise exception such as:

let exit_my_program () = failwith "...." 

but, i'd like:

let exit_my_program () =     print.printf "some error message\n";     exit 1 

the issue i'm having exit 1 has type 'a deferred.t , it's not going typecheck. i'm wondering if there's exit function type 'a use in context, or maybe more generally, function force deferred.

the function pervasives.exit of type int -> 'a. don't know async, don't know if it's plan use function. it's easy believe might not such plan if want things wind down carefully.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -