From dd34aff49d40755ae4f6dd6176f41619681c6541 Mon Sep 17 00:00:00 2001
From: Salma El Hattech <salma.elhattech@hotmail.com>
Date: Mon, 8 Mar 2021 15:25:22 +0100
Subject: [PATCH] Modification of model.ml and model.mli

---
 model.ml  | 13 ++++++++-----
 model.mli |  8 +++++---
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/model.ml b/model.ml
index bc17b95..c31acd3 100644
--- a/model.ml
+++ b/model.ml
@@ -35,10 +35,10 @@ let build ~filename =
        Onnx
       end
     in 
-    print_string "";
-
+    print_newline();
+    Ok { format; filename }
   else
-    Format.printf "The file: %s doesn't exist\n" filename;
+    Error (Format.sprintf "No such file `%s'." filename)
 ;;
 
 let flag = ref 0;;
@@ -157,10 +157,12 @@ let content_file filename =
 ;;
 
 let my_fun filename = 
-        build filename;
-        content_file filename;    
+        build ~filename;;
+let my_fun2 filename =
+        content_file filename;
 ;;
 
+
 (*This command is used to create an interface with the user such that they can insert the name of the file
 to be tested.
 In order to compile the code, use : 
@@ -169,3 +171,4 @@ To run the executable, use :
 ./(name_of_the_executable) (name_of_the_nnet_file.nnet) *)
 
 my_fun Sys.argv.(1);;
+my_fun2 Sys.argv.(1);;
diff --git a/model.mli b/model.mli
index f7294cc..26993da 100644
--- a/model.mli
+++ b/model.mli
@@ -22,12 +22,14 @@ type record = {
 
     The model is inferred from the [filename] extension.
 *)
-val build: filename:string -> t -> unit
+val build: filename:string -> (t, string) Result.t
 
 (** Verifies the content of the given [filename] and checks 
     if the conditions are satisfied.
 *)
-val content_file: filename:string -> t -> unit
+val content_file:string -> unit
 
 (** The main function of the program *)
-val my_fun: filename:string -> t -> unit
+val my_fun:string -> (t, string) Result.t
+val my_fun2:string -> unit
+
-- 
GitLab