aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@chimrod.com>2017-06-19 05:54:49 +0200
committerSébastien Dailly <sebastien@chimrod.com>2017-06-19 05:54:49 +0200
commit8db278b1e6331d55ef6aa11964c88144af3c4fce (patch)
treeb5cc5930027e7e7b1b1187f709a7e7c40f22c8b5
parent0d1f9ff76aa6df3f17edd2d73c76ab444fec8528 (diff)
Refactoring
-rwxr-xr-xevaluator.ml25
-rwxr-xr-xunicode.ml2
2 files changed, 19 insertions, 8 deletions
diff --git a/evaluator.ml b/evaluator.ml
index 490ab43..26541c7 100755
--- a/evaluator.ml
+++ b/evaluator.ml
@@ -32,13 +32,17 @@ let t_int = Num
let t_string = String
let t_list t = List t
-let typ_of_format: type a. a dataFormat -> a typ = function
+let typ_of_format:
+type a. a dataFormat -> a typ =
+function
| Date -> Num
| Number -> Num
| String -> String
| Bool -> Bool
-let rec compare_typ: type a b. a typ -> b typ -> (a, b) T.cmp = begin fun a b ->
+let rec compare_typ:
+type a b. a typ -> b typ -> (a, b) T.cmp =
+begin fun a b ->
match a, b with
| Unit, Unit -> T.Eq
| Bool, Bool -> T.Eq
@@ -53,7 +57,9 @@ let rec compare_typ: type a b. a typ -> b typ -> (a, b) T.cmp = begin fun a b ->
| x, y -> if (T.Ex x) > (T.Ex y) then T.Gt else T.Lt
end
-let rec print_typ: type a. Format.formatter -> a typ -> unit = fun printer typ -> match typ with
+let rec print_typ:
+type a. Format.formatter -> a typ -> unit =
+fun printer typ -> match typ with
| Unit -> Format.fprintf printer "Unit"
| Bool -> Format.fprintf printer "Bool"
| Num -> Format.fprintf printer "Num"
@@ -269,7 +275,9 @@ module C = struct
catalog := Catalog.add name' map !catalog
end
- let inject: type a. a result -> (unit -> a dataFormat) -> a -> existencialResult = fun resultFormat f res ->
+ let inject:
+ type a. a result -> (unit -> a dataFormat) -> a -> existencialResult =
+ fun resultFormat f res ->
let (x:a value) = begin match resultFormat, res with
| Bool, x -> Bool x
| Numeric, x -> Num (f (), x)
@@ -280,7 +288,9 @@ module C = struct
Result x
(** Look in the catalog for a function with the given name and signature *)
- let find_function: type a. string -> a t_function sig_typ -> a t_function = begin fun name signature ->
+ let find_function:
+ type a. string -> a t_function sig_typ -> a t_function =
+ begin fun name signature ->
Catalog.find (String.uppercase_ascii name) !catalog
|> Functions.find signature
end
@@ -290,8 +300,9 @@ end
(** Guess the format to use for the result function from the arguments given.
The most specialized format take over the others.
*)
-let guess_format_result: type a. a result -> existencialResult list -> unit -> a dataFormat =
- begin fun init_value values () ->
+let guess_format_result:
+type a. a result -> existencialResult list -> unit -> a dataFormat =
+begin fun init_value values () ->
let init_typ = typ_of_result init_value in
diff --git a/unicode.ml b/unicode.ml
index eb0d60d..cc8c087 100755
--- a/unicode.ml
+++ b/unicode.ml
@@ -1,4 +1,4 @@
-type t = Uutf.uchar array
+type t = Uchar.t array
type decoder_encoding = Uutf.decoder_encoding