Permalink
Browse files

Expose parsed OCaml version

  • Loading branch information...
1 parent 3ae4a35 commit 15dae1338dde8b455a90b97bb5c1d8ec04841d72 @kerneis kerneis committed Jun 30, 2014
Showing with 7 additions and 5 deletions.
  1. +3 −5 src/ocamlutil/util.ml
  2. +4 −0 src/ocamlutil/util.mli
View
@@ -1,8 +1,3 @@
-(** Utility functions for Coolaid *)
-module E = Errormsg
-module H = Hashtbl
-module IH = Inthash
-
(* tail-recursive append: reverses xs twice *)
let list_append (xs: 'a list) (ys: 'a list): 'a list =
match xs with (* optimize some common cases *)
@@ -60,3 +55,6 @@ let list_map_opt f = function
let equals x1 x2 : bool =
(compare x1 x2) = 0
+
+let (ocaml_major_version,ocaml_minor_version) =
+ Scanf.sscanf Sys.ocaml_version "%d.%d" (fun x y -> (x,y))
View
@@ -20,3 +20,7 @@ val list_map_opt : ('a -> 'b) -> 'a list option -> 'b list option
name or id in some field that occurs before any fields that have cyclic
pointers. *)
val equals: 'a -> 'a -> bool
+
+(** Convenient access to components of Sys.ocaml_version. *)
+val ocaml_major_version: int
+val ocaml_minor_version: int

0 comments on commit 15dae13

Please sign in to comment.