File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 11# IO System
2- System effects for Coq.
2+ System effects for Coq. See [ coq : io ] ( https://github.com/clarus/io ) .
33
44 Require Import Io.All.
55 Require Import Io.System.All.
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ Module String.
2828 Extract Constant to_lstring => "IoSystem.String.to_lstring".
2929End String.
3030
31- (** Unbounded integers . *)
31+ (** Interface to the Big_int library . *)
3232Module BigInt.
3333 (** The OCaml's `bigint` type. *)
3434 Definition t : Type := bigint.
@@ -37,6 +37,13 @@ Module BigInt.
3737 Definition to_Z : t -> Z := z_of_bigint.
3838End BigInt.
3939
40+ (** Interface to the Sys library. *)
41+ Module Sys.
42+ (** The command line arguments of the program. *)
43+ Parameter argv : list String.t.
44+ Extract Constant argv => "IoSystem.argv".
45+ End Sys.
46+
4047(** Interface to the Lwt library. *)
4148Module Lwt.
4249 (** The `Lwt.t` type. *)
@@ -117,3 +124,8 @@ Fixpoint eval {A : Type} (x : C.t System.effects A) : Lwt.t A :=
117124 | C.Call command => eval_command command
118125 | C.Let _ _ x f => Lwt.bind (eval x) (fun x => eval (f x))
119126 end .
127+
128+ (** Run the main function. *)
129+ Definition run (main : list LString.t -> C.t System.effects unit) : unit :=
130+ let argv := List.map String.to_lstring Sys.argv in
131+ Extraction .Lwt.run (Extraction .eval (main argv)).
You can’t perform that action at this time.
0 commit comments