Skip to content

Commit

Permalink
Switch to sexplib0 for lighter dependencies
Browse files Browse the repository at this point in the history
`sexplib0` only depends on `ocaml` and `dune`. It contains the type
definition and some conversion functions. `conduit` does not use
anything else (like a parser, etc) so it can use it.
(`sexplib` already depends on `sexplib0` so it's using the same types
under the hood)

The corresponding bits are:
- `sexplib` (opam package and library) -> `sexplib0`
- `Sexplib.Conv` (module) -> `Sexplib0.Sexp_conv`
- `Sexplib.Std` -> `Sexplib0.Sexp_conv` (we only need these bits)
- `Sexplib.Sexp.to_string_hum` -> `Sexplib0.Sexp.to_string_hum`
  • Loading branch information
emillon committed Jun 24, 2024
1 parent 81fe395 commit 66ac4f7
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion conduit-async.opam
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ depends: [
"uri" {>= "4.0.0"}
"ppx_here" {>= "v0.9.0"}
"ppx_sexp_conv" {>="v0.13.0"}
"sexplib"
"sexplib0"
"conduit" {=version}
"async" {>= "v0.15.0"}
"ipaddr" {>= "3.0.0"}
Expand Down
2 changes: 1 addition & 1 deletion conduit-lwt.opam
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ depends: [
"dune" {>= "2.0"}
"base-unix"
"ppx_sexp_conv" {>="v0.13.0"}
"sexplib"
"sexplib0"
"conduit" {=version}
"lwt" {>= "3.0.0"}
]
Expand Down
2 changes: 1 addition & 1 deletion conduit-mirage.opam
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ depends: [
"ocaml" {>= "4.08.0"}
"dune" {>= "2.0"}
"ppx_sexp_conv" {>="v0.13.0"}
"sexplib"
"sexplib0"
"uri" {>= "4.0.0"}
"cstruct" {>= "3.0.0"}
"mirage-clock" {>= "3.0.0"}
Expand Down
2 changes: 1 addition & 1 deletion conduit.opam
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ depends: [
"ocaml" {>= "4.08.0"}
"dune" {>= "2.0"}
"ppx_sexp_conv" {>="v0.13.0"}
"sexplib"
"sexplib0"
"astring"
"uri"
"logs" {>= "0.5.0"}
Expand Down
6 changes: 3 additions & 3 deletions src/conduit-lwt-unix/conduit_lwt_unix.ml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*)

open Lwt.Infix
open Sexplib.Conv
open Sexplib0.Sexp_conv

let debug = ref false
let debug_print = ref Printf.eprintf
Expand Down Expand Up @@ -49,7 +49,7 @@ let tls_library = ref default_tls_library
let () =
if !debug then
!debug_print "Selected TLS library: %s\n"
(Sexplib.Sexp.to_string (sexp_of_tls_lib !tls_library))
(Sexplib0.Sexp.to_string (sexp_of_tls_lib !tls_library))

type +'a io = 'a Lwt.t
type ic = Lwt_io.input_channel
Expand Down Expand Up @@ -429,7 +429,7 @@ let endp_to_client ~ctx:_ (endp : Conduit.endp) : client Lwt.t =
Lwt.fail_with
(Printf.sprintf "TLS to non-TCP currently unsupported: host=%s endp=%s"
host
(Sexplib.Sexp.to_string_hum (Conduit.sexp_of_endp endp)))
(Sexplib0.Sexp.to_string_hum (Conduit.sexp_of_endp endp)))
| `Unknown err -> Lwt.fail_with ("resolution failed: " ^ err)

let endp_to_server ~ctx (endp : Conduit.endp) =
Expand Down
4 changes: 2 additions & 2 deletions src/conduit-lwt-unix/resolver_lwt_unix.ml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ let () =
let return_endp name svc uri endp =
if !debug then
!debug_print "Resolver %s: %s %s -> %s\n%!" name (Uri.to_string uri)
(Sexplib.Sexp.to_string_hum (Resolver.sexp_of_service svc))
(Sexplib.Sexp.to_string_hum (Conduit.sexp_of_endp endp));
(Sexplib0.Sexp.to_string_hum (Resolver.sexp_of_service svc))
(Sexplib0.Sexp.to_string_hum (Conduit.sexp_of_endp endp));
Lwt.return endp

let is_tls_service =
Expand Down
2 changes: 1 addition & 1 deletion src/conduit-mirage/conduit_mirage.ml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
let src = Logs.Src.create "conduit_mirage" ~doc:"Conduit Mirage"

module Log = (val Logs.src_log src : Logs.LOG)
open Sexplib.Conv
open Sexplib0.Sexp_conv

let ( >>= ) = Lwt.( >>= )
let ( >|= ) = Lwt.( >|= )
Expand Down
2 changes: 1 addition & 1 deletion src/conduit-mirage/conduit_xenstore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
*)

open Sexplib.Conv
open Sexplib0.Sexp_conv

type direct = [ `Direct of int * Vchan.Port.t ]

Expand Down
2 changes: 1 addition & 1 deletion src/conduit-mirage/resolver_mirage.ml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ struct
(* Strip the tld from the hostname *)
let remote_name = get_short_host uri in
Printf.printf "vchan_lookup: %s %s -> normalizes to %s\n%!"
(Sexplib.Sexp.to_string_hum (Resolver.sexp_of_service service))
(Sexplib0.Sexp.to_string_hum (Resolver.sexp_of_service service))
(Uri.to_string uri) remote_name;
Lwt.return (`Vchan_domain_socket (remote_name, service.Resolver.name))

Expand Down
2 changes: 1 addition & 1 deletion src/conduit/conduit.ml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
*)

open Sexplib.Std
open Sexplib0.Sexp_conv

type endp =
[ `TCP of Ipaddr_sexp.t * int (** ipaddr and dst port *)
Expand Down
2 changes: 1 addition & 1 deletion src/conduit/conduit_trie.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
*)

open Sexplib.Std
open Sexplib0.Sexp_conv

type 'a t = Node of string * 'a option * 'a t list [@@deriving sexp]

Expand Down
2 changes: 1 addition & 1 deletion src/conduit/dune
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
(preprocess
(pps ppx_sexp_conv))
(modules conduit conduit_trie resolver)
(libraries sexplib ipaddr ipaddr-sexp uri astring))
(libraries sexplib0 ipaddr ipaddr-sexp uri astring))

(documentation
(package conduit))
2 changes: 1 addition & 1 deletion src/conduit/resolver.ml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
*)

open Sexplib.Std
open Sexplib0.Sexp_conv
open Astring

type service = { name : string; port : int; tls : bool } [@@deriving sexp]
Expand Down

0 comments on commit 66ac4f7

Please sign in to comment.