From b85719784c15e6572dede84b76dbcadaddf592f6 Mon Sep 17 00:00:00 2001
From: domq <dominique@quatravaux.org>
Date: Mon, 22 Jun 2020 15:40:23 +0200
Subject: [PATCH] Updates for modern ocaml (#92)

* [fix] OCaml 4.08.1 no longer likes `Pervasives.compare`

* [fix] Update suggested ocamlc commands

Fixes #74

* [doc] Instructions for utop

Co-authored-by: Dominique Quatravaux <dominique.quatravaux@epfl.ch>
---
 README.md                        | 12 ++++++++++--
 src/generator/gen_unicode.ml.inc |  4 ++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index a8741b3..24a664c 100644
--- a/README.md
+++ b/README.md
@@ -199,13 +199,13 @@ Installation (after "make"):
 Compilation of OCaml files with lexer specifications:
 
 ```
-  ocamlfind ocamlc -c -package sedlex my_file.ml
+  ocamlfind ocamlc -c -package sedlex.ppx my_file.ml
 ```
 
 When linking, you must also include the sedlex package:
 
 ```
-  ocamlfind ocamlc -o my_prog -linkpkg -package sedlex my_file.cmo
+  ocamlfind ocamlc -o my_prog -linkpkg -package sedlex.ppx my_file.cmo
 ```
 
 
@@ -221,6 +221,14 @@ source file through -ppx rewriter ppx_sedlex. Moreover, you need to
 link the application with the runtime support library for sedlex
 (sedlexing.cma / sedlexing.cmxa).
 
+### With utop
+
+Once sedlex is installed as per above, simply type
+
+```
+#require "sedlex.ppx";;
+```
+
 ## Examples
 
 The `examples/` subdirectory contains several samples of sedlex in use.
diff --git a/src/generator/gen_unicode.ml.inc b/src/generator/gen_unicode.ml.inc
index 44106a1..78415fc 100644
--- a/src/generator/gen_unicode.ml.inc
+++ b/src/generator/gen_unicode.ml.inc
@@ -77,14 +77,14 @@ let split list n =
 
 let print_elements ch hashtbl =
   let cats =
-    List.sort_uniq Pervasives.compare
+    List.sort_uniq compare
       (Hashtbl.fold (fun cat _ l -> cat::l) hashtbl [])
   in
   let len = List.length cats in
   List.iter (fun c ->
     let entries =
       List.map (fun (b,e) -> Printf.sprintf "0x%x, 0x%x" b e)
-        (List.sort_uniq Pervasives.compare
+        (List.sort_uniq compare
           (Hashtbl.find_all hashtbl c))
     in
     let entries =
