Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Expose parsed OCaml version

  • Loading branch information...
commit 15dae1338dde8b455a90b97bb5c1d8ec04841d72 1 parent 3ae4a35
@kerneis kerneis authored
Showing with 7 additions and 5 deletions.
  1. +3 −5 src/ocamlutil/util.ml
  2. +4 −0 src/ocamlutil/util.mli
View
8 src/ocamlutil/util.ml
@@ -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
4 src/ocamlutil/util.mli
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.