1+ open Import
2+
13module Route = struct
24 open Printf
35
@@ -7,13 +9,13 @@ module Route = struct
79 | Literal of string * t
810 | Param of string option * t
911
10- let rec sexp_of_t (t : t ) : Sexplib0. Sexp.t =
12+ let rec sexp_of_t (t : t ) : Sexp.t =
1113 match t with
1214 | Nil -> Atom " Nil"
1315 | Full_splat -> Atom " Full_splat"
1416 | Literal (x , y ) -> List [ Atom x; sexp_of_t y ]
1517 | Param (x , y ) ->
16- let x : Sexplib0. Sexp.t =
18+ let x : Sexp.t =
1719 match x with
1820 | Some x -> Atom (" :" ^ x)
1921 | None -> Atom " *"
@@ -39,11 +41,11 @@ module Route = struct
3941 let name =
4042 let len = String. length token in
4143 if len > 1
42- then String. sub token 1 (len - 1 )
44+ then String. sub token ~pos: 1 ~len: (len - 1 )
4345 else raise (E " Named paramter is missing a name" )
4446 in
4547 let params =
46- if List. mem name params
48+ if List. mem name ~set: params
4749 then raise (E (sprintf " duplicate parameter %S" name))
4850 else name :: params
4951 in
@@ -52,7 +54,7 @@ module Route = struct
5254 ;;
5355
5456 let of_string_exn s =
55- let tokens = String. split_on_char '/' s in
57+ let tokens = String. split_on_char ~sep: '/' s in
5658 match tokens with
5759 | "" :: tokens -> parse_tokens [] tokens
5860 | _ -> raise (E " route must start with /" )
@@ -72,8 +74,8 @@ module Params = struct
7274 }
7375
7476 let sexp_of_t { named; unnamed } =
75- let open Sexplib0. Sexp_conv in
76- Sexplib0. Sexp.List
77+ let open Sexp_conv in
78+ Sexp. List
7779 [ List
7880 [ Atom " named"
7981 ; sexp_of_list (sexp_of_pair sexp_of_string sexp_of_string) named
@@ -114,15 +116,13 @@ type 'a t =
114116 ; param : 'a t option
115117 }
116118
117- let sexp_of_smap f smap : Sexplib0.Sexp.t =
118- List
119- (Smap. bindings smap
120- |> ListLabels. map ~f: (fun (k , v ) -> Sexplib0.Sexp. List [ Atom k; f v ]))
119+ let sexp_of_smap f smap : Sexp.t =
120+ List (Smap. bindings smap |> List. map ~f: (fun (k , v ) -> Sexp. List [ Atom k; f v ]))
121121;;
122122
123123let rec sexp_of_t f { data; literal; param } =
124- let open Sexplib0. Sexp_conv in
125- Sexplib0. Sexp.List
124+ let open Sexp_conv in
125+ Sexp. List
126126 [ List [ Atom " data" ; sexp_of_option (sexp_of_pair f Route. sexp_of_t) data ]
127127 ; List [ Atom " literal" ; sexp_of_smap (sexp_of_t f) literal ]
128128 ; List [ Atom " param" ; sexp_of_option (sexp_of_t f) param ]
@@ -132,7 +132,7 @@ let rec sexp_of_t f { data; literal; param } =
132132let empty = { data = None ; literal = Smap. empty; param = None }
133133
134134let match_url t url =
135- let tokens = String. split_on_char '/' url in
135+ let tokens = String. split_on_char ~sep: '/' url in
136136 match tokens with
137137 | "" :: tokens ->
138138 let rec loop t captured tokens =
0 commit comments