Skip to content

Commit 36409e7

Browse files
committed
Run with argv added
1 parent 100cb39 commit 36409e7

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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.

src/Extraction.v

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Module String.
2828
Extract Constant to_lstring => "IoSystem.String.to_lstring".
2929
End String.
3030

31-
(** Unbounded integers. *)
31+
(** Interface to the Big_int library. *)
3232
Module 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.
3838
End 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. *)
4148
Module 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)).

0 commit comments

Comments
 (0)